Introduction
ProgressRing represents a control that indicates an operation is ongoing. The typical visual appearance is a ring-shaped "spinner" that cycles an animation as progress continues.
In the following demo, we are going to start and stop a ProgressRing with the help of buttons.
Step 1
Open a blank app and add a ProgressRing control and two buttons named Start and Stop either from the toolbox or by copying the following XAML code into your grid.
IsActive defines animation - <StackPanel>
- <StackPanel Orientation="Horizontal" Margin="50,80,0,0">
- <Button Name="start" Content="Start" Click="start_Click"></Button>
- <Button Name="stop" Content="Stop" Click="stop_Click" Margin="30,0,0,0"></Button>
- </StackPanel>
- <ProgressRing Name="myRing" IsActive="False" Height="50" Width="50" HorizontalAlignment="Left" Margin="80,30,0,0"></ProgressRing>
- </StackPanel>
Step 2
Set the value of IsActive to True for start button event handler and to false for the end button event handler respectively.
- private void start_Click(object sender, RoutedEventArgs e)
- {
- myRing.IsActive = true;
- }
- private void stop_Click(object sender, RoutedEventArgs e)
- {
- myRing.IsActive = false;
- }
Step 3
Run the application and click on the start button to start the ProgressRing.
Summary
In this article, we learned about progressRing control for Windows 10.