Skip to content

Commit e888897

Browse files
committed
feat: add avalonia extend NumericUpDown style.
1 parent d192cdb commit e888897

File tree

4 files changed

+361
-2
lines changed

4 files changed

+361
-2
lines changed

src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/NumericUpDownDemo.axaml

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,149 @@
1111
<hc:UniformSpacingPanel Spacing="16"
1212
Orientation="Vertical">
1313
<NumericUpDown Value="0"
14-
Width="380"
1514
Maximum="100" />
1615
<NumericUpDown Value="0"
1716
IsEnabled="False" />
1817
<NumericUpDown Value="0"
1918
IsReadOnly="True" />
19+
20+
<NumericUpDown Value="0"
21+
hc:TitleElement.Title="This is the title"
22+
Theme="{StaticResource NumericUpDownExtend}" />
23+
<NumericUpDown Value="0"
24+
Watermark="Please enter content"
25+
hc:TitleElement.Title="This is the title"
26+
hc:InfoElement.Necessary="True"
27+
Theme="{StaticResource NumericUpDownExtend}" />
28+
<NumericUpDown Value="0"
29+
Width="380"
30+
hc:TitleElement.TitleWidth="140"
31+
hc:TitleElement.TitlePlacement="Left"
32+
hc:TitleElement.Title="The title is on the left"
33+
Theme="{StaticResource NumericUpDownExtend}" />
34+
<NumericUpDown FormatString="N2"
35+
Maximum="100000"
36+
Value="10000"
37+
Width="380"
38+
hc:TitleElement.TitleWidth="140"
39+
Watermark="Please enter content"
40+
hc:TitleElement.TitlePlacement="Left"
41+
hc:TitleElement.Title="The title is on the left"
42+
Theme="{StaticResource NumericUpDownExtend}"
43+
hc:InfoElement.Necessary="True" />
44+
</hc:UniformSpacingPanel>
45+
<hc:UniformSpacingPanel Spacing="16"
46+
Orientation="Vertical">
47+
<NumericUpDown hc:InfoElement.ShowClearButton="True"
48+
Theme="{StaticResource NumericUpDownExtend}"
49+
Value="{Binding DoubleValue1}" />
50+
<NumericUpDown Value="0"
51+
IsEnabled="False"
52+
Theme="{StaticResource NumericUpDownExtend}" />
53+
<NumericUpDown Value="0"
54+
IsReadOnly="True"
55+
Theme="{StaticResource NumericUpDownExtend}" />
56+
57+
<NumericUpDown Value="0"
58+
hc:InfoElement.ShowClearButton="True"
59+
hc:TitleElement.Title="This is the title"
60+
Theme="{StaticResource NumericUpDownExtend}" />
61+
<NumericUpDown Value="0"
62+
Watermark="Please enter content"
63+
hc:TitleElement.Title="This is the title"
64+
hc:InfoElement.Necessary="True"
65+
Theme="{StaticResource NumericUpDownExtend}" />
66+
<NumericUpDown Value="0"
67+
Width="380"
68+
hc:TitleElement.TitleWidth="140"
69+
hc:TitleElement.TitlePlacement="Left"
70+
hc:TitleElement.Title="The title is on the left"
71+
Theme="{StaticResource NumericUpDownExtend}" />
72+
<NumericUpDown Value="0"
73+
FormatString="N2"
74+
hc:InfoElement.ShowClearButton="True"
75+
Width="380"
76+
hc:TitleElement.TitleWidth="140"
77+
Watermark="Please enter content"
78+
hc:TitleElement.TitlePlacement="Left"
79+
hc:TitleElement.Title="The title is on the left"
80+
Theme="{StaticResource NumericUpDownExtend}"
81+
hc:InfoElement.Necessary="True" />
82+
</hc:UniformSpacingPanel>
83+
<hc:UniformSpacingPanel Spacing="16"
84+
Orientation="Vertical">
85+
<NumericUpDown Value="0"
86+
Maximum="100"
87+
Theme="{StaticResource NumericUpDown.Small}" />
88+
<NumericUpDown Value="0"
89+
IsEnabled="False"
90+
Theme="{StaticResource NumericUpDown.Small}" />
91+
<NumericUpDown Value="0"
92+
IsReadOnly="True"
93+
Theme="{StaticResource NumericUpDown.Small}" />
94+
95+
<NumericUpDown Value="0"
96+
hc:TitleElement.Title="This is the title"
97+
Theme="{StaticResource NumericUpDownExtend.Small}" />
98+
<NumericUpDown Value="0"
99+
Watermark="Please enter content"
100+
hc:TitleElement.Title="This is the title"
101+
hc:InfoElement.Necessary="True"
102+
Theme="{StaticResource NumericUpDownExtend.Small}" />
103+
<NumericUpDown Value="0"
104+
Width="380"
105+
hc:TitleElement.TitleWidth="140"
106+
hc:TitleElement.TitlePlacement="Left"
107+
hc:TitleElement.Title="The title is on the left"
108+
Theme="{StaticResource NumericUpDownExtend.Small}" />
109+
<NumericUpDown FormatString="N2"
110+
Maximum="100000"
111+
Value="10000"
112+
Width="380"
113+
hc:TitleElement.TitleWidth="140"
114+
Watermark="Please enter content"
115+
hc:TitleElement.TitlePlacement="Left"
116+
hc:TitleElement.Title="The title is on the left"
117+
Theme="{StaticResource NumericUpDownExtend.Small}"
118+
hc:InfoElement.Necessary="True" />
119+
</hc:UniformSpacingPanel>
120+
<hc:UniformSpacingPanel Spacing="16"
121+
Orientation="Vertical">
122+
<NumericUpDown hc:InfoElement.ShowClearButton="True"
123+
Theme="{StaticResource NumericUpDownExtend.Small}"
124+
Value="{Binding DoubleValue1}" />
125+
<NumericUpDown Value="0"
126+
IsEnabled="False"
127+
Theme="{StaticResource NumericUpDownExtend.Small}" />
128+
<NumericUpDown Value="0"
129+
IsReadOnly="True"
130+
Theme="{StaticResource NumericUpDownExtend.Small}" />
131+
132+
<NumericUpDown Value="0"
133+
hc:InfoElement.ShowClearButton="True"
134+
hc:TitleElement.Title="This is the title"
135+
Theme="{StaticResource NumericUpDownExtend.Small}" />
136+
<NumericUpDown Value="0"
137+
Watermark="Please enter content"
138+
hc:TitleElement.Title="This is the title"
139+
hc:InfoElement.Necessary="True"
140+
Theme="{StaticResource NumericUpDownExtend.Small}" />
141+
<NumericUpDown Value="0"
142+
Width="380"
143+
hc:TitleElement.TitleWidth="140"
144+
hc:TitleElement.TitlePlacement="Left"
145+
hc:TitleElement.Title="The title is on the left"
146+
Theme="{StaticResource NumericUpDownExtend.Small}" />
147+
<NumericUpDown Value="0"
148+
FormatString="N2"
149+
hc:InfoElement.ShowClearButton="True"
150+
Width="380"
151+
hc:TitleElement.TitleWidth="140"
152+
Watermark="Please enter content"
153+
hc:TitleElement.TitlePlacement="Left"
154+
hc:TitleElement.Title="The title is on the left"
155+
Theme="{StaticResource NumericUpDownExtend.Small}"
156+
hc:InfoElement.Necessary="True" />
20157
</hc:UniformSpacingPanel>
21158
</hc:UniformSpacingPanel>
22159
</ScrollViewer>

src/Avalonia/HandyControlDemo_Avalonia/ViewModel/Common/InputElementDemoViewModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ [Required] [ObservableProperty] [NotifyDataErrorInfo]
1616

1717
[Required] [ObservableProperty] [NotifyDataErrorInfo]
1818
private string? _text2;
19+
20+
[ObservableProperty] private double? _doubleValue1;
21+
22+
[ObservableProperty] private double? _doubleValue2;
1923
}

src/Avalonia/HandyControl_Avalonia/Themes/Styles/ButtonSpinner.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
BorderBrush="{TemplateBinding BorderBrush}"
3636
BorderThickness="{TemplateBinding BorderThickness}"
3737
CornerRadius="{TemplateBinding CornerRadius}" />
38-
<DockPanel>
38+
<DockPanel Margin="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='1,0,1,0'}">
3939
<UniformGrid Name="PART_SpinnerPanel"
4040
TabIndex="2"
4141
DockPanel.Dock="Right"

0 commit comments

Comments
 (0)