fix: fix height issue.

This commit is contained in:
rabbitism 2023-03-27 23:03:27 +08:00
parent 5f7e84bf08
commit ffd1c7d89a
4 changed files with 24 additions and 0 deletions

View File

@ -27,5 +27,15 @@
Maximum="100"
Minimum="0"
ShowButtonSpinner="False" />
<NumericUpDown
Width="200"
Classes="Large"
Maximum="100"
Minimum="0" />
<NumericUpDown
Width="200"
Classes="Small"
Maximum="100"
Minimum="0" />
</StackPanel>
</UserControl>

View File

@ -5,6 +5,7 @@
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type NumericUpDown}" TargetType="NumericUpDown">
<Setter Property="NumericUpDown.VerticalContentAlignment" Value="Center" />
<Setter Property="NumericUpDown.MinHeight" Value="{DynamicResource NumericUpDownWrapperDefaultHeight}" />
<Setter Property="NumericUpDown.CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
<Setter Property="NumericUpDown.Template">
<ControlTemplate TargetType="NumericUpDown">
@ -36,6 +37,13 @@
</ButtonSpinner>
</ControlTemplate>
</Setter>
<Style Selector="^.Large">
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownWrapperLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownWrapperSmallHeight}" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@ -1,4 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<CornerRadius x:Key="NumericUpDownCornerRadius">3</CornerRadius>
<x:Double x:Key="NumericUpDownWrapperDefaultHeight">32</x:Double>
<x:Double x:Key="NumericUpDownWrapperSmallHeight">24</x:Double>
<x:Double x:Key="NumericUpDownWrapperLargeHeight">40</x:Double>
</ResourceDictionary>

View File

@ -1,4 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<CornerRadius x:Key="NumericUpDownCornerRadius">3</CornerRadius>
<x:Double x:Key="NumericUpDownWrapperDefaultHeight">32</x:Double>
<x:Double x:Key="NumericUpDownWrapperSmallHeight">24</x:Double>
<x:Double x:Key="NumericUpDownWrapperLargeHeight">40</x:Double>
</ResourceDictionary>