Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Busy Indicator with the DomainDataSource Control

0.00/5 (No votes)
12 Apr 2011 1  
Using the BusyIndicator with the DomainDataSource control

We have seen a code-behind approach for the BusyIndicator where based on the Load operation, we set the IsBusy property of the BusyIndicator to true or false. The following example shows a sample code which enables the BusyIndicator during continuous operations and using the code-behind approach.

biLoading.IsBusy = true;

//-- Do Some Work//
biLoading.IsBusy = false;

The above approach is straightforward and this post is about how to use the BusyIndicator declaratively along with XAML code. As we know, the DomainDataSource control enables interaction between the XAML user interface and the DataContext. Mostly, it is used for achieving binding to a specific control through XAML.

The sample code used for data binding using the 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 the DomainDataSource control can be found here.

Using the BusyIndicator Declaratively, Along with XAML

Let's say we want to implement the above BusyIndicator scenario not using the code behind. To do that, drag and drop the BusyIndicator control to the Silverlight page and make the 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 DomainDataSource control, exactly the same as above.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here