Merge pull request #366 from irihitech/issue/363
NumericUpDown family updates
This commit is contained in:
@@ -57,9 +57,10 @@
|
||||
Margin="0,0,8,0"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding $parent[u:KeyGestureInput].Clear}"
|
||||
Content="{DynamicResource IconButtonClearData}"
|
||||
Focusable="False"
|
||||
IsVisible="False"
|
||||
Theme="{DynamicResource InputClearButton}" />
|
||||
Theme="{DynamicResource InnerIconButton}" />
|
||||
</Grid>
|
||||
</Panel>
|
||||
</Border>
|
||||
|
||||
@@ -4,29 +4,9 @@
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
<!-- Add Resources Here -->
|
||||
|
||||
<ControlTheme x:Key="InputClearButton" TargetType="Button">
|
||||
<Setter Property="Button.Foreground" Value="{DynamicResource TextBoxButtonDefaultForeground}" />
|
||||
<Setter Property="Button.Cursor" Value="Hand" />
|
||||
<Setter Property="Button.Template">
|
||||
<ControlTemplate TargetType="Button">
|
||||
<!-- Background must be transparent or hit test will fail -->
|
||||
<ContentControl Background="Transparent">
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{DynamicResource TextBoxClearButtonData}"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
</ContentControl>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextBoxButtonPointeroverForeground}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<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>
|
||||
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownDefaultHeight}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:NumericUpDown">
|
||||
<DataValidationErrors>
|
||||
@@ -52,6 +32,7 @@
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
||||
InnerRightContent="{TemplateBinding InnerRightContent}"
|
||||
TextWrapping="NoWrap"
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
Watermark="{TemplateBinding Watermark}" />
|
||||
@@ -68,7 +49,8 @@
|
||||
Command="{Binding $parent[u:NumericUpDown].Clear}"
|
||||
Focusable="False"
|
||||
IsVisible="False"
|
||||
Theme="{StaticResource InputClearButton}" />
|
||||
Content="{DynamicResource IconButtonClearData}"
|
||||
Theme="{DynamicResource InnerIconButton}" />
|
||||
</Panel>
|
||||
</ButtonSpinner>
|
||||
</DataValidationErrors>
|
||||
@@ -83,5 +65,12 @@
|
||||
<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>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Ursa.Controls;
|
||||
[TemplatePart(PART_Spinner, typeof(ButtonSpinner))]
|
||||
[TemplatePart(PART_TextBox, typeof(TextBox))]
|
||||
[TemplatePart(PART_DragPanel, typeof(Panel))]
|
||||
public abstract class NumericUpDown : TemplatedControl, IClearControl
|
||||
public abstract class NumericUpDown : TemplatedControl, IClearControl, IInnerContentControl
|
||||
{
|
||||
public const string PART_Spinner = "PART_Spinner";
|
||||
public const string PART_TextBox = "PART_TextBox";
|
||||
@@ -62,8 +62,9 @@ public abstract class NumericUpDown : TemplatedControl, IClearControl
|
||||
set => SetValue(HorizontalContentAlignmentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<object?> InnerLeftContentProperty = AvaloniaProperty.Register<NumericUpDown, object?>(
|
||||
nameof(InnerLeftContent));
|
||||
public static readonly StyledProperty<object?> InnerLeftContentProperty =
|
||||
AvaloniaProperty.Register<NumericUpDown, object?>(
|
||||
nameof(InnerLeftContent));
|
||||
|
||||
public object? InnerLeftContent
|
||||
{
|
||||
@@ -71,6 +72,16 @@ public abstract class NumericUpDown : TemplatedControl, IClearControl
|
||||
set => SetValue(InnerLeftContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<object?> InnerRightContentProperty =
|
||||
AvaloniaProperty.Register<NumericUpDown, object?>(
|
||||
nameof(InnerRightContent));
|
||||
|
||||
public object? InnerRightContent
|
||||
{
|
||||
get => GetValue(InnerRightContentProperty);
|
||||
set => SetValue(InnerRightContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string?> WatermarkProperty = AvaloniaProperty.Register<NumericUpDown, string?>(
|
||||
nameof(Watermark));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user