WPF - Loading image to show page loading status
In my wpf application i am playing videos from the mms server. These video files takes few seconds to load. I want to display loading(waiting) image during that loading process. Can anyone guid me for th开发者_C百科is.
Geetha
Wrap all your contents in a grid and put an extra Grid at the end of the Grid for your loading content. It is very important to put the LoadingGrid below your Grid with the content because when you make it visible it will cover the hole wrapper and will be on top of your contents. The Grid with the contents could also be of another type than Grid (ex: DockPanel, ...).
Example:
<Grid>
<Grid>
<TextBlock Text="All my contents" />
</Grid>
<Grid x:Name="LoadingGrid" Background="#60FFFFFF" Visibility="Collapsed">
<TextBlock Text="Please wait while loading ..." />
</Grid>
</Grid>
Now you can Bind the Visiblity property of the LoadingGrid to a property IsBusy in your ViewModel or you can Set the Visibility property of the LoadingGrid in the Code behind.
精彩评论