Files
Ursa.Avalonia/src/Ursa.Themes.Semi/Controls/NumericUpDown.axaml
rabbitism 4989192d36 feat: 1. add InnerRightContent to NumericUpDown
2. Add Small/Large size classes.
3. Use shared close button theme in Semi.Avalonia.
2024-08-24 19:23:36 +08:00

77 lines
4.1 KiB
XML

<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type u:NumericUpDown}" TargetType="{x:Type u:NumericUpDown}">
<Setter Property="CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownDefaultHeight}" />
<Setter Property="Template">
<ControlTemplate TargetType="u:NumericUpDown">
<DataValidationErrors>
<ButtonSpinner
Name="PART_Spinner"
MinWidth="0"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowSpin="{TemplateBinding AllowSpin}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
<Panel>
<TextBox
Name="PART_TextBox"
Height="{TemplateBinding Height}"
MinHeight="{TemplateBinding MinHeight}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
AcceptsReturn="False"
CornerRadius="{TemplateBinding CornerRadius}"
DataValidationErrors.Errors="{ReflectionBinding $parent[u:NumericUpDown].(DataValidationErrors.Errors)}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
InnerLeftContent="{TemplateBinding InnerLeftContent}"
InnerRightContent="{TemplateBinding InnerRightContent}"
TextWrapping="NoWrap"
Theme="{DynamicResource NonErrorTextBox}"
Watermark="{TemplateBinding Watermark}" />
<Panel
Name="PART_DragPanel"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent"
Cursor="SizeAll"/>
<Button
Name="PART_ClearButton"
Margin="0,0,8,0"
HorizontalAlignment="Right"
Command="{Binding $parent[u:NumericUpDown].Clear}"
Focusable="False"
IsVisible="False"
Content="{DynamicResource IconButtonClearData}"
Theme="{DynamicResource InnerIconButton}" />
</Panel>
</ButtonSpinner>
</DataValidationErrors>
</ControlTemplate>
</Setter>
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^[IsReadOnly=False]:focus /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^[IsReadOnly=False]:pointerover /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
</Style>
</Style>
<Style Selector="^.Large">
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownSmallHeight}" />
</Style>
</ControlTheme>
</ResourceDictionary>