項目中如下實現遮蓋的加載效果,代碼不統一,且實現的耦合性比較多,封裝了一個加載的控件.
使用方法:
1.添加:
<ResourceDictionary Source="/BusyIndicatorCtrl;Component/BusyIndicator.xaml"/>
2.在所要的容器中插入 BusyIndicator :
<Grid Grid.Row="0" Width="800" Height="300" Background="Beige">
<s:BusyIndicator x:Name="busyCtrl" />
<Label Content="BusyIndicator 將遮蓋它的父容器"></Label>
</Grid>
設置加載內容的文件並顯示:
this.busyCtrl.IsBusy = true;
this.busyCtrl.Text = "Loading Content...";