feat: add NumericUpDown template. No resource is required in this control.
This commit is contained in:
parent
0b2b2473a6
commit
668634fb61
34
demo/Semi.Avalonia.Demo/Pages/NumericUpDownDemo.axaml
Normal file
34
demo/Semi.Avalonia.Demo/Pages/NumericUpDownDemo.axaml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="Semi.Avalonia.Demo.Pages.NumericUpDownDemo"
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<StackPanel
|
||||||
|
Margin="20"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Spacing="20">
|
||||||
|
<NumericUpDown
|
||||||
|
Width="200"
|
||||||
|
Maximum="100"
|
||||||
|
Minimum="0" />
|
||||||
|
<NumericUpDown
|
||||||
|
Width="200"
|
||||||
|
Increment="10"
|
||||||
|
Maximum="100"
|
||||||
|
Minimum="0" />
|
||||||
|
<NumericUpDown
|
||||||
|
Width="200"
|
||||||
|
ButtonSpinnerLocation="Left"
|
||||||
|
Maximum="100"
|
||||||
|
Minimum="0" />
|
||||||
|
<NumericUpDown
|
||||||
|
Width="200"
|
||||||
|
Maximum="100"
|
||||||
|
Minimum="0"
|
||||||
|
ShowButtonSpinner="False" />
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
18
demo/Semi.Avalonia.Demo/Pages/NumericUpDownDemo.axaml.cs
Normal file
18
demo/Semi.Avalonia.Demo/Pages/NumericUpDownDemo.axaml.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
public partial class NumericUpDownDemo : UserControl
|
||||||
|
{
|
||||||
|
public NumericUpDownDemo()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
@ -48,6 +48,9 @@
|
|||||||
<TabItem Header="Notification">
|
<TabItem Header="Notification">
|
||||||
<pages:NotificationDemo />
|
<pages:NotificationDemo />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem Header="NumericUpDown">
|
||||||
|
<pages:NumericUpDownDemo />
|
||||||
|
</TabItem>
|
||||||
<TabItem Header="ProgressBar">
|
<TabItem Header="ProgressBar">
|
||||||
<pages:ProgressBarDemo />
|
<pages:ProgressBarDemo />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
@ -1,3 +1,37 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<!-- Add Resources Here -->
|
<!-- Add Resources Here -->
|
||||||
|
<ControlTheme x:Key="{x:Type NumericUpDown}" TargetType="NumericUpDown">
|
||||||
|
<Setter Property="NumericUpDown.VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="NumericUpDown.Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<ButtonSpinner
|
||||||
|
Name="PART_Spinner"
|
||||||
|
MinWidth="0"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
VerticalContentAlignment="Stretch"
|
||||||
|
AllowSpin="{TemplateBinding AllowSpin}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
|
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
|
||||||
|
<TextBox
|
||||||
|
Name="PART_TextBox"
|
||||||
|
MinWidth="0"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
AcceptsReturn="False"
|
||||||
|
FontSize="{TemplateBinding FontSize}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||||
|
Text="{TemplateBinding Text}"
|
||||||
|
TextWrapping="NoWrap"
|
||||||
|
Watermark="{TemplateBinding Watermark}" />
|
||||||
|
</ButtonSpinner>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user