Click here to Skip to main content
15,868,016 members
Articles / Desktop Programming / WPF

Busy Indicator with the DomainDataSource Control

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
12 Apr 2011CPOL 10.6K  
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.

C#
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:

XML
<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:

XML
<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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Microsoft
India India
Nothing special .. I like challenges and love my critics.

Microsoft | Bangalore | India

Blog : http://manaspatnaik.com/blog

Twitter@manas_patnaik

Comments and Discussions

 
-- There are no messages in this forum --