Ghost1372

everything can be handy

ProgressButton

Attributes

Property
ProgressBackground
ProgressForeground
ProgressRingHorizontalAlignment
ProgressRingSize
ProgressRingVisibility
IsIndeterminateProgressRing
ProgressRingStyle
CheckedContent
ShowError
ShowPaused
IsIndeterminate
Progress

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
<dev:ProgressButton Width="200"
Checked="ProgressButton_Checked"
CheckedContent="Downloading..."
Content="Click Here"
Unchecked="ProgressButton_Checked" />

<dev:ProgressButton Width="200"
Checked="ProgressButton_Checked"
CheckedContent="Downloading..."
Content="Click Here"
IsIndeterminateProgressRing="true"
ProgressRingVisibility="Visible"
Unchecked="ProgressButton_Checked" />
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
private async void ProgressButton_Checked(object sender, RoutedEventArgs e)
{
var pb = sender as ProgressButton;
if (pb.IsChecked.Value && !pb.IsIndeterminate)
{
pb.Progress = 0;
while (true)
{
pb.Progress += 1;
await Task.Delay(50);
if (pb.Progress == 100)
{
pb.IsChecked = false;
break;
}
}
}
}

Demo

you can run demo and see this feature.

DevWinUI

0%