Using BusyIndicator in Silverlight

Use namespace :  using System.Threading;
 

In xaml code,

 <Grid x:Name="LayoutRoot" Background="White">      
            <toolkit:BusyIndicator HorizontalAlignment="Center" VerticalAlignment="Center"
                                Name="busyIndicator" IsBusy="False">
                <StackPanel>
                    <Button x:Name="btnClick" Content="Click Here" Width="100" Height="25"
                        Click="btnClick_Click"/>
                </StackPanel>
            </toolkit:BusyIndicator>           
    </Grid>


In Button Click c# code,

 busyIndicator.IsBusy = true;
 busyIndicator.BusyContent = "Fetching Data...";
 \\ Here you can add youw own text

 ThreadPool.QueueUserWorkItem((state) =>
 {
 Thread.Sleep(3 * 1000);
 Dispatcher.BeginInvoke(() => busyIndicator.IsBusy = false);
});

No comments:

Post a Comment