@@ -9,75 +9,75 @@ namespace Maui.Controls.Sample;
99
1010public partial class AbsoluteLayoutOptionsPage : ContentPage
1111{
12- private AbsoluteLayoutViewModel _viewModel ;
13- public AbsoluteLayoutOptionsPage ( AbsoluteLayoutViewModel viewModel )
14- {
15- InitializeComponent ( ) ;
16- _viewModel = viewModel ;
17- BindingContext = _viewModel ;
18- }
12+ private AbsoluteLayoutViewModel _viewModel ;
13+ public AbsoluteLayoutOptionsPage ( AbsoluteLayoutViewModel viewModel )
14+ {
15+ InitializeComponent ( ) ;
16+ _viewModel = viewModel ;
17+ BindingContext = _viewModel ;
18+ }
1919
20- private void ApplyButton_Clicked ( object sender , EventArgs e )
21- {
22- Navigation . PopAsync ( ) ;
23- }
20+ private void ApplyButton_Clicked ( object sender , EventArgs e )
21+ {
22+ Navigation . PopAsync ( ) ;
23+ }
2424
25- private void OnLayoutFlagCheckedChanged ( object sender , CheckedChangedEventArgs e )
26- {
27- AbsoluteLayoutFlags flags = AbsoluteLayoutFlags . None ;
25+ private void OnLayoutFlagCheckedChanged ( object sender , CheckedChangedEventArgs e )
26+ {
27+ AbsoluteLayoutFlags flags = AbsoluteLayoutFlags . None ;
2828
29- if ( chkX . IsChecked )
30- flags |= AbsoluteLayoutFlags . XProportional ;
31- if ( chkY . IsChecked )
32- flags |= AbsoluteLayoutFlags . YProportional ;
33- if ( chkWidth . IsChecked )
34- flags |= AbsoluteLayoutFlags . WidthProportional ;
35- if ( chkHeight . IsChecked )
36- flags |= AbsoluteLayoutFlags . HeightProportional ;
37- if ( chkPosition . IsChecked )
38- flags |= AbsoluteLayoutFlags . PositionProportional ;
39- if ( chkSize . IsChecked )
40- flags |= AbsoluteLayoutFlags . SizeProportional ;
41- if ( chkAll . IsChecked )
42- flags |= AbsoluteLayoutFlags . All ;
29+ if ( chkX . IsChecked )
30+ flags |= AbsoluteLayoutFlags . XProportional ;
31+ if ( chkY . IsChecked )
32+ flags |= AbsoluteLayoutFlags . YProportional ;
33+ if ( chkWidth . IsChecked )
34+ flags |= AbsoluteLayoutFlags . WidthProportional ;
35+ if ( chkHeight . IsChecked )
36+ flags |= AbsoluteLayoutFlags . HeightProportional ;
37+ if ( chkPosition . IsChecked )
38+ flags |= AbsoluteLayoutFlags . PositionProportional ;
39+ if ( chkSize . IsChecked )
40+ flags |= AbsoluteLayoutFlags . SizeProportional ;
41+ if ( chkAll . IsChecked )
42+ flags |= AbsoluteLayoutFlags . All ;
4343
44- if ( chkNone . IsChecked )
45- flags = AbsoluteLayoutFlags . None ;
44+ if ( chkNone . IsChecked )
45+ flags = AbsoluteLayoutFlags . None ;
4646
47- _viewModel . LayoutFlags = flags ;
48- }
47+ _viewModel . LayoutFlags = flags ;
48+ }
4949
50- private void IsVisibleRadio_CheckedChanged ( object sender , CheckedChangedEventArgs e )
51- {
52- if ( ! ( sender is RadioButton rb ) || ! rb . IsChecked )
53- return ;
54- _viewModel . IsVisible = rb . Content ? . ToString ( ) == "True" ;
55- }
50+ private void IsVisibleRadio_CheckedChanged ( object sender , CheckedChangedEventArgs e )
51+ {
52+ if ( ! ( sender is RadioButton rb ) || ! rb . IsChecked )
53+ return ;
54+ _viewModel . IsVisible = rb . Content ? . ToString ( ) == "True" ;
55+ }
5656
57- private void OnFlowDirectionChanged ( object sender , EventArgs e )
58- {
59- _viewModel . FlowDirection = FlowDirectionLTR . IsChecked ? FlowDirection . LeftToRight : FlowDirection . RightToLeft ;
60- }
61-
62- private void OnBackgroundColorChanged ( object sender , EventArgs e )
63- {
64- if ( BindingContext is AbsoluteLayoutViewModel vm && sender is Button button && button . Text is string color )
65- {
66- switch ( color )
67- {
68- case "Red" :
69- vm . BackgroundColor = Colors . Red ;
70- break ;
71- case "Gray" :
72- vm . BackgroundColor = Colors . Gray ;
73- break ;
74- case "LightYellow" :
75- vm . BackgroundColor = Colors . LightYellow ;
76- break ;
77- default :
78- vm . BackgroundColor = Colors . White ;
79- break ;
80- }
81- }
82- }
57+ private void OnFlowDirectionChanged ( object sender , EventArgs e )
58+ {
59+ _viewModel . FlowDirection = FlowDirectionLTR . IsChecked ? FlowDirection . LeftToRight : FlowDirection . RightToLeft ;
60+ }
61+
62+ private void OnBackgroundColorChanged ( object sender , EventArgs e )
63+ {
64+ if ( BindingContext is AbsoluteLayoutViewModel vm && sender is Button button && button . Text is string color )
65+ {
66+ switch ( color )
67+ {
68+ case "Red" :
69+ vm . BackgroundColor = Colors . Red ;
70+ break ;
71+ case "Gray" :
72+ vm . BackgroundColor = Colors . Gray ;
73+ break ;
74+ case "LightYellow" :
75+ vm . BackgroundColor = Colors . LightYellow ;
76+ break ;
77+ default :
78+ vm . BackgroundColor = Colors . White ;
79+ break ;
80+ }
81+ }
82+ }
8383}
0 commit comments