1
+ using System ;
2
+ using Android . Widget ;
3
+ using Android . Views ;
4
+ using AButton = Android . Widget . Button ;
5
+ using AOrientation = Android . Widget . Orientation ;
6
+
7
+ namespace Microsoft . Maui . Handlers
8
+ {
9
+ public partial class StepperHandler : AbstractViewHandler < IStepper , LinearLayout > , IStepperHandler
10
+ {
11
+ AButton ? _downButton ;
12
+ AButton ? _upButton ;
13
+
14
+ IStepper ? IStepperHandler . VirtualView => VirtualView ;
15
+
16
+ AButton ? IStepperHandler . UpButton => _upButton ;
17
+
18
+ AButton ? IStepperHandler . DownButton => _downButton ;
19
+
20
+ protected override LinearLayout CreateNativeView ( )
21
+ {
22
+ var stepperLayout = new LinearLayout ( Context )
23
+ {
24
+ Orientation = AOrientation . Horizontal ,
25
+ Focusable = true ,
26
+ DescendantFocusability = DescendantFocusability . AfterDescendants
27
+ } ;
28
+
29
+ StepperHandlerManager . CreateStepperButtons ( this , out _downButton , out _upButton ) ;
30
+
31
+ if ( _downButton != null )
32
+ stepperLayout . AddView ( _downButton , new LinearLayout . LayoutParams ( ViewGroup . LayoutParams . WrapContent , ViewGroup . LayoutParams . MatchParent ) ) ;
33
+
34
+ if ( _upButton != null )
35
+ stepperLayout . AddView ( _upButton , new LinearLayout . LayoutParams ( ViewGroup . LayoutParams . WrapContent , ViewGroup . LayoutParams . MatchParent ) ) ;
36
+
37
+ return stepperLayout ;
38
+ }
39
+
40
+ public static void MapMinimum ( StepperHandler handler , IStepper stepper )
41
+ {
42
+ handler . TypedNativeView ? . UpdateMinimum ( stepper ) ;
43
+ }
44
+
45
+ public static void MapMaximum ( StepperHandler handler , IStepper stepper )
46
+ {
47
+ handler . TypedNativeView ? . UpdateMaximum ( stepper ) ;
48
+ }
49
+
50
+ public static void MapIncrement ( StepperHandler handler , IStepper stepper )
51
+ {
52
+ handler . TypedNativeView ? . UpdateIncrement ( stepper ) ;
53
+ }
54
+
55
+ public static void MapValue ( StepperHandler handler , IStepper stepper )
56
+ {
57
+ handler . TypedNativeView ? . UpdateValue ( stepper ) ;
58
+ }
59
+
60
+ AButton IStepperHandler . CreateButton ( )
61
+ {
62
+ if ( Context == null )
63
+ throw new ArgumentException ( "Context is null or empty" , nameof ( Context ) ) ;
64
+
65
+ var button = new AButton ( Context ) ;
66
+ button . SetHeight ( ( int ) Context . ToPixels ( 10.0 ) ) ;
67
+ return button ;
68
+ }
69
+ }
70
+ }
0 commit comments