使用 DomainDataSource 控件的忙碌指示器





0/5 (0投票)
将 BusyIndicator 与 DomainDataSource 控件一起使用。
我们已经见过一种代码隐藏方法来实现 BusyIndicator
,根据 Load
操作,将 BusyIndicator
的 IsBusy
属性设置为 true
或 false
。 以下示例显示了一个示例代码,它在连续操作期间启用 BusyIndicator
,并使用代码隐藏方法。
biLoading.IsBusy = true;
//-- Do Some Work//
biLoading.IsBusy = false;
上述方法很简单,而这篇文章是关于如何使用 XAML 代码声明性地使用 BusyIndicator
。 众所周知,DomainDataSource
控件能够实现 XAML 用户界面与 DataContext
之间的交互。 大多数情况下,它用于通过 XAML 实现对特定控件的绑定。
使用 DomainDataSource
控件进行数据绑定的示例代码如下
<riaControls:DomainDataSource AutoLoad="True"
d:DesignData="{d:DesignInstance my:CustomerPresentationModel,
CreateList=true}" Height="0"
LoadedData="customerPresentationModelDomainDataSource_LoadedData"
Name="customerPresentationModelDomainDataSource"
QueryName="GetCustomersWithAddressQuery" Width="0"
LoadSize="30" PageSize="10">
<riaControls:DomainDataSource.DomainContext>
<my:ADVWORKDomainContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
关于 DomainDataSource
控件的更多详细信息可以在 这里 找到。
声明性地使用忙指示器,以及 XAML
假设我们想要实现上述 BusyIndicator
场景,而无需使用代码隐藏。 为此,将 BusyIndicator
控件拖放到 Silverlight 页面,并对 XAML 代码进行以下更改
<toolkit:BusyIndicator Height="75" HorizontalAlignment="Center"
Margin="0" Name="biLoading"
VerticalAlignment="Center" Width="200"
IsBusy="{Binding Path=IsBusy,
ElementName=customerPresentationModelDomainDataSource}"
IsEnabled="True" />
将 BusyIndicator
的 Isbusy
属性绑定到 DomainDataSource
控件,就像上面一样。