Để tạo hiệu ứng chờ loading ảnh, Image Control có 2 event là ImageFailed và ImageOpened. Để dễ dàng sử dụng ta tạo riêng một control để hiển thị ảnh và xử lý.
Tạo User Control
Sử Dụng Trong ViewPage
<grid>
<local:imageloadercontrol source="{Binding UrlFull}">
<local:imageloadercontrol .loadingcontent="">
<stackpanel horizontalalignment="Center" verticalalignment="Center">
<progressring foreground="White" height="50" horizontalalignment="Center" isactive="True" width="50">
<textblock horizontalalignment="Center" margin="5" text="Loading...">
</textblock></progressring></stackpanel>
</local:imageloadercontrol>
<local:imageloadercontrol .failedcontent="">
<textblock horizontalalignment="Center" text="Load Failed: We,re sorry, there was a problem completing the request. Please check your network connectivity ad try again." textwrapping="Wrap" verticalalignment="Center">
</textblock></local:imageloadercontrol>
</local:imageloadercontrol>
</grid>
[Tips] Loading Images with Progress in UWP
Related Tags :Tips and Tricks Universal Windows Platform
No comments:
Post a Comment
Commets Download Photoshop Actions, Lightroom Presets, PSD Template, Mockups, Stocks, Vectors, Fonts. Download free