@@ -2,110 +2,110 @@ namespace Maui.Controls.Sample;
2
2
3
3
public partial class ProgressBarControlPage : ContentPage
4
4
{
5
- private ProgressBarViewModel _viewModel ;
6
- private ProgressBar progressBar ;
5
+ private ProgressBarViewModel _viewModel ;
6
+ private ProgressBar progressBar ;
7
7
8
- public ProgressBarControlPage ( )
9
- {
10
- InitializeComponent ( ) ;
11
- _viewModel = new ProgressBarViewModel ( ) ;
12
- BindingContext = _viewModel ;
13
- }
8
+ public ProgressBarControlPage ( )
9
+ {
10
+ InitializeComponent ( ) ;
11
+ _viewModel = new ProgressBarViewModel ( ) ;
12
+ BindingContext = _viewModel ;
13
+ }
14
14
15
- private void ReinitializeProgressBar ( )
16
- {
17
- BindingContext = _viewModel = new ProgressBarViewModel ( ) ;
18
- ProgressBarGrid . Children . Clear ( ) ;
19
- progressBar = new ProgressBar
20
- {
21
- AutomationId = "ProgressBarControl" ,
22
- } ;
15
+ private void ReinitializeProgressBar ( )
16
+ {
17
+ BindingContext = _viewModel = new ProgressBarViewModel ( ) ;
18
+ ProgressBarGrid . Children . Clear ( ) ;
19
+ progressBar = new ProgressBar
20
+ {
21
+ AutomationId = "ProgressBarControl" ,
22
+ } ;
23
23
24
- progressBar . SetBinding ( ProgressBar . BackgroundColorProperty , nameof ( ProgressBarViewModel . BackgroundColor ) ) ;
25
- progressBar . SetBinding ( ProgressBar . FlowDirectionProperty , nameof ( ProgressBarViewModel . FlowDirection ) ) ;
26
- progressBar . SetBinding ( ProgressBar . IsVisibleProperty , nameof ( ProgressBarViewModel . IsVisible ) ) ;
27
- progressBar . SetBinding ( ProgressBar . ProgressProperty , nameof ( ProgressBarViewModel . Progress ) ) ;
28
- progressBar . SetBinding ( ProgressBar . ProgressColorProperty , nameof ( ProgressBarViewModel . ProgressColor ) ) ;
29
- progressBar . SetBinding ( ProgressBar . ShadowProperty , nameof ( ProgressBarViewModel . Shadow ) ) ;
30
- ProgressBarGrid . Children . Add ( progressBar ) ;
31
- }
24
+ progressBar . SetBinding ( ProgressBar . BackgroundColorProperty , nameof ( ProgressBarViewModel . BackgroundColor ) ) ;
25
+ progressBar . SetBinding ( ProgressBar . FlowDirectionProperty , nameof ( ProgressBarViewModel . FlowDirection ) ) ;
26
+ progressBar . SetBinding ( ProgressBar . IsVisibleProperty , nameof ( ProgressBarViewModel . IsVisible ) ) ;
27
+ progressBar . SetBinding ( ProgressBar . ProgressProperty , nameof ( ProgressBarViewModel . Progress ) ) ;
28
+ progressBar . SetBinding ( ProgressBar . ProgressColorProperty , nameof ( ProgressBarViewModel . ProgressColor ) ) ;
29
+ progressBar . SetBinding ( ProgressBar . ShadowProperty , nameof ( ProgressBarViewModel . Shadow ) ) ;
30
+ ProgressBarGrid . Children . Add ( progressBar ) ;
31
+ }
32
32
33
- private void OnProgressChanged ( object sender , TextChangedEventArgs e )
34
- {
35
- if ( double . TryParse ( ProgressEntry . Text , out double progress ) )
36
- {
37
- _viewModel . Progress = progress ;
38
- }
39
- }
33
+ private void OnProgressChanged ( object sender , TextChangedEventArgs e )
34
+ {
35
+ if ( double . TryParse ( ProgressEntry . Text , out double progress ) )
36
+ {
37
+ _viewModel . Progress = progress ;
38
+ }
39
+ }
40
40
41
- private void ProgressColorButton_Clicked ( object sender , EventArgs e )
42
- {
43
- var button = ( Button ) sender ;
44
- if ( button . Text == "Green" )
45
- _viewModel . ProgressColor = Colors . Green ;
46
- else if ( button . Text == "Red" )
47
- _viewModel . ProgressColor = Colors . Red ;
48
- }
41
+ private void ProgressColorButton_Clicked ( object sender , EventArgs e )
42
+ {
43
+ var button = ( Button ) sender ;
44
+ if ( button . Text == "Green" )
45
+ _viewModel . ProgressColor = Colors . Green ;
46
+ else if ( button . Text == "Red" )
47
+ _viewModel . ProgressColor = Colors . Red ;
48
+ }
49
49
50
- private void BackgroundColorButton_Clicked ( object sender , EventArgs e )
51
- {
52
- var button = ( Button ) sender ;
53
- if ( button . Text == "Orange" )
54
- _viewModel . BackgroundColor = Colors . Orange ;
55
- else if ( button . Text == "Light Blue" )
56
- _viewModel . BackgroundColor = Colors . LightBlue ;
57
- }
50
+ private void BackgroundColorButton_Clicked ( object sender , EventArgs e )
51
+ {
52
+ var button = ( Button ) sender ;
53
+ if ( button . Text == "Orange" )
54
+ _viewModel . BackgroundColor = Colors . Orange ;
55
+ else if ( button . Text == "Light Blue" )
56
+ _viewModel . BackgroundColor = Colors . LightBlue ;
57
+ }
58
58
59
- private void OnIsVisibleCheckedChanged ( object sender , CheckedChangedEventArgs e )
60
- {
61
- var radioButton = sender as RadioButton ;
62
- if ( radioButton != null && radioButton . IsChecked )
63
- {
64
- _viewModel . IsVisible = false ;
65
- }
66
- }
59
+ private void OnIsVisibleCheckedChanged ( object sender , CheckedChangedEventArgs e )
60
+ {
61
+ var radioButton = sender as RadioButton ;
62
+ if ( radioButton != null && radioButton . IsChecked )
63
+ {
64
+ _viewModel . IsVisible = false ;
65
+ }
66
+ }
67
67
68
- private void OnFlowDirectionChanged ( object sender , EventArgs e )
69
- {
70
- var radioButton = sender as RadioButton ;
71
- if ( radioButton != null && radioButton . IsChecked )
72
- {
73
- _viewModel . FlowDirection = radioButton . Content . ToString ( ) == "LTR" ? FlowDirection . LeftToRight : FlowDirection . RightToLeft ;
74
- }
75
- }
68
+ private void OnFlowDirectionChanged ( object sender , EventArgs e )
69
+ {
70
+ var radioButton = sender as RadioButton ;
71
+ if ( radioButton != null && radioButton . IsChecked )
72
+ {
73
+ _viewModel . FlowDirection = radioButton . Content . ToString ( ) == "LTR" ? FlowDirection . LeftToRight : FlowDirection . RightToLeft ;
74
+ }
75
+ }
76
76
77
- private void OnShadowCheckedChanged ( object sender , CheckedChangedEventArgs e )
78
- {
79
- var radioButton = ( RadioButton ) sender ;
80
- if ( radioButton != null && radioButton . IsChecked )
81
- {
82
- _viewModel . Shadow = new Shadow { Brush = Colors . Violet , Radius = 20 , Offset = new Point ( 0 , 0 ) , Opacity = 1f } ;
83
- }
84
- }
77
+ private void OnShadowCheckedChanged ( object sender , CheckedChangedEventArgs e )
78
+ {
79
+ var radioButton = ( RadioButton ) sender ;
80
+ if ( radioButton != null && radioButton . IsChecked )
81
+ {
82
+ _viewModel . Shadow = new Shadow { Brush = Colors . Violet , Radius = 20 , Offset = new Point ( 0 , 0 ) , Opacity = 1f } ;
83
+ }
84
+ }
85
85
86
- private void ProgressToButton_Clicked ( object sender , EventArgs e )
87
- {
88
- if ( ! string . IsNullOrWhiteSpace ( ProgressToEntry . Text ) )
89
- {
90
- if ( progressBar == null )
91
- {
92
- progressBarControl . ProgressTo ( double . Parse ( ProgressToEntry . Text ) , 1000 , Easing . Linear ) ;
93
- }
94
- else
95
- {
96
- progressBar . ProgressTo ( double . Parse ( ProgressToEntry . Text ) , 1000 , Easing . Linear ) ;
97
- }
98
- }
99
- }
86
+ private void ProgressToButton_Clicked ( object sender , EventArgs e )
87
+ {
88
+ if ( ! string . IsNullOrWhiteSpace ( ProgressToEntry . Text ) )
89
+ {
90
+ if ( progressBar == null )
91
+ {
92
+ progressBarControl . ProgressTo ( double . Parse ( ProgressToEntry . Text ) , 1000 , Easing . Linear ) ;
93
+ }
94
+ else
95
+ {
96
+ progressBar . ProgressTo ( double . Parse ( ProgressToEntry . Text ) , 1000 , Easing . Linear ) ;
97
+ }
98
+ }
99
+ }
100
100
101
- private void ResetButton_Clicked ( object sender , EventArgs e )
102
- {
103
- ProgressEntry . Text = "0.50" ;
104
- ProgressToEntry . Text = "0" ;
105
- IsVisibleTrueRadio . IsChecked = false ;
106
- FlowDirectionLTR . IsChecked = false ;
107
- FlowDirectionRTL . IsChecked = false ;
108
- ShadowFalseRadio . IsChecked = false ;
109
- ReinitializeProgressBar ( ) ;
110
- }
101
+ private void ResetButton_Clicked ( object sender , EventArgs e )
102
+ {
103
+ ProgressEntry . Text = "0.50" ;
104
+ ProgressToEntry . Text = "0" ;
105
+ IsVisibleTrueRadio . IsChecked = false ;
106
+ FlowDirectionLTR . IsChecked = false ;
107
+ FlowDirectionRTL . IsChecked = false ;
108
+ ShadowFalseRadio . IsChecked = false ;
109
+ ReinitializeProgressBar ( ) ;
110
+ }
111
111
}
0 commit comments