We have seen a code behind approach for a Busy Indicator where, based on a Load operation, we set an IsBusy property of Busyindicator as either true or false. The following example shows sample code that enables a busy indicator with continuous operations and a Code Behind approach. biLoading.IsBusy = true; //-- Do Some Work// biLoading.IsBusy = false; How ever the above approach is straight forward and this article is how to use a Busy Indicator declaratively along with XAML code. As we know the DomainDataSource control enables interaction between a XAML user interface and the DataContext. Mostly it is used for binding to a specific control through XAML. Sample code used for data binding using DomainDataSource control is as follows: <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>
We have seen a code behind approach for a Busy Indicator where, based on a Load operation, we set an IsBusy property of Busyindicator as either true or false. The following example shows sample code that enables a busy indicator with continuous operations and a Code Behind approach.
biLoading.IsBusy = true; //-- Do Some Work// biLoading.IsBusy = false;
How ever the above approach is straight forward and this article is how to use a Busy Indicator declaratively along with XAML code. As we know the DomainDataSource control enables interaction between a XAML user interface and the DataContext. Mostly it is used for binding to a specific control through XAML.
Sample code used for data binding using DomainDataSource control is as follows:
<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>
More details about a DomainDataSource Control can be found from here.
Well with the above scenario we want to implement the Busy Indicator; not from code behind. To implement a busy indicator drag and drop the the Busy Indicator control to the silverlight page and make following changes to the XAML code.
<toolkit:BusyIndicator Height="75" HorizontalAlignment="Center" Margin="0" Name="biLoading" VerticalAlignment="Center" Width="200" IsBusy="{Binding Path=IsBusy, ElementName=customerPresentationModelDomainDataSource}" IsEnabled="True" />
Bind the Isbusy property of the BusyIndicator to the DomainDataSourceControl, exactly the same as above.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: