How to work with the Silverlight BusyIndicator?
Silverlight BusyIndicator is not a new thing in Silverlight. It was first added in Silverlight 3 Toolkit in November 2009 release (if I am n...- Article authored by Kunal Chowdhury on .
Silverlight BusyIndicator is not a new thing in Silverlight. It was first added in Silverlight 3 Toolkit in November 2009 release (if I am n...- Article authored by Kunal Chowdhury on .
<StackPanel> <TextBlock Text="Silverlight Toolkit Busy Indicator Demo" FontSize="36" FontWeight="Bold" Foreground="Red" TextWrapping="Wrap" TextAlignment="Center"/> <Button x:Name="btnClick" Content="Click Here" Width="100" Height="25" Click="btnClick_Click"/> </StackPanel>
<Grid x:Name="LayoutRoot" Background="White"> <toolkit:BusyIndicator HorizontalAlignment="Center" VerticalAlignment="Center" Name="busyIndicator" IsBusy="False"> <StackPanel> <TextBlock Text="Silverlight Toolkit Busy Indicator Demo" FontSize="36" FontWeight="Bold" Foreground="Red" TextWrapping="Wrap" TextAlignment="Center"/> <Button x:Name="btnClick" Content="Click Here" Width="100" Height="25" Click="btnClick_Click"/> </StackPanel> </toolkit:BusyIndicator> </Grid>
/// <summary> /// Handles the Click event of the btnClick control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance /// containing the event data.</param> private void btnClick_Click(object sender, RoutedEventArgs e) { busyIndicator.IsBusy = true; //busyIndicator.BusyContent = "Fetching Data..."; ThreadPool.QueueUserWorkItem((state) => { Thread.Sleep(3 * 1000); Dispatcher.BeginInvoke(() => busyIndicator.IsBusy = false); }); }
busyIndicator.BusyContent = "Fetching Data...";
Solution Architect & Former Microsoft MVP
Kunal Chowdhury is an enterprise solution architect and former multi-year Microsoft MVP. He is the author of three technical books: Windows Presentation Foundation Development Cookbook, Mastering Visual Studio 2017, and the Mastering Visual Studio 2019.
He publishes technical and non-technical articles on Kunal-Chowdhury.com.