Ajax Style Loading Animation in Silverlight

1.7k views Asked by At

I am building a Silverlight application around the new Navigation framework. Due to the nature of the application, there will be quite a bit of waiting around.

To that end, I'd like to add an Ajax-style loading animation to all my navigation pages. In other words, while I go and get the data for any of the pages, I want to be showing the loading animation.

I can't seem to find any up-to-date examples?

2

There are 2 answers

0
daxsorbito On BEST ANSWER

I think to achieve this is to use the BusyIndicator.

You would reference this:

xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 

Then use the BusyIndicator like this (please note of the binding).

    <toolkit:BusyIndicator x:Name="busyIndicator" IsBusy="{Binding Path=IsBusy}">
        <toolkit:BusyIndicator.BusyContent>
             <StackPanel>
                 <TextBlock >Fetching data...</TextBlock>
                 <Rectangle RadiusX="10" RadiusY="10" Fill="#80000000" />
             </StackPanel>
         </toolkit:BusyIndicator.BusyContent>
         ....... XAML Code here
    </toolkit:BusyIndicator>

Then on your ViewModel you raise the IsBusy property whenever you would call a service to fetch a data or whatever process needed (I'm using the GalaSoft.MvvmLight).

RaisePropertyChanged("IsBusy");
0
Konamiman On

You may want to take a look at the Activity control.