Merge pull request #170 from heartacker/acker/und_new_feature_3_20
bug fix and add new NumericUpDownDemo
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net7.0-android</TargetFramework>
|
<TargetFramework>net8.0-android</TargetFramework>
|
||||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ApplicationId>com.irihitech.Ursa</ApplicationId>
|
<ApplicationId>com.irihitech.Ursa</ApplicationId>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
|
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
|
||||||
<WasmMainJSPath>AppBundle\main.js</WasmMainJSPath>
|
<WasmMainJSPath>AppBundle\main.js</WasmMainJSPath>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0-ios</TargetFramework>
|
<TargetFramework>net8.0-ios</TargetFramework>
|
||||||
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -8,19 +8,170 @@
|
|||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<UserControl.Styles>
|
<UserControl.Styles>
|
||||||
<Style Selector=":is(u|NumericUpDown)">
|
<Style Selector=":is(u|NumericUpDown)">
|
||||||
<Setter Property="Width" Value="240"></Setter>
|
<Setter Property="Width" Value="240" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||||
</Style>
|
</Style>
|
||||||
</UserControl.Styles>
|
</UserControl.Styles>
|
||||||
<StackPanel HorizontalAlignment="Left">
|
|
||||||
<u:NumericIntUpDown Name="input" InnerLeftContent="Age" Step="1" Value="2" Watermark="Input Value" Classes="ClearButton" />
|
<Grid ColumnDefinitions="*,*">
|
||||||
<TextBlock Text="{Binding #input.Value}" ></TextBlock>
|
<Grid
|
||||||
<u:NumericDoubleUpDown Name="inputDouble" Step="0.5" Value="3.1" EmptyInputValue="1"></u:NumericDoubleUpDown>
|
Grid.Column="0"
|
||||||
<TextBlock Text="{Binding #inputDouble.Value}"></TextBlock>
|
HorizontalAlignment="Left"
|
||||||
<u:NumericByteUpDown Name="inputByte" Step="1" Value="3" EmptyInputValue="1"></u:NumericByteUpDown>
|
RowDefinitions="200,*">
|
||||||
<TextBlock Text="{Binding #inputByte.Value}"></TextBlock>
|
<StackPanel>
|
||||||
<TextBlock Text="Drag"></TextBlock>
|
<u:Divider Content="Change Right ->" />
|
||||||
<u:NumericIntUpDown Step="1" Value="2" Watermark="Input Value" AllowDrag="True" />
|
<u:NumericUIntUpDown
|
||||||
</StackPanel>
|
Name="numd"
|
||||||
|
HorizontalContentAlignment="{Binding HorizontalContentAlignment}"
|
||||||
|
AllowDrag="{Binding AllowDrag}"
|
||||||
|
AllowSpin="{Binding AllowSpin}"
|
||||||
|
FontFamily="{Binding FontFamily, Mode=OneWay}"
|
||||||
|
FormatString="{Binding FormatString}"
|
||||||
|
InnerLeftContent="{Binding InnerLeftContent}"
|
||||||
|
IsEnabled="{Binding IsEnable}"
|
||||||
|
IsReadOnly="{Binding IsReadOnly}"
|
||||||
|
Maximum="{Binding Maximum}"
|
||||||
|
Minimum="{Binding Minimum}"
|
||||||
|
ParsingNumberStyle="{Binding ParsingNumberStyle}"
|
||||||
|
ShowButtonSpinner="{Binding ShowButtonSpinner}"
|
||||||
|
Step="{Binding Step}"
|
||||||
|
Watermark="{Binding Watermark}"
|
||||||
|
Value="{Binding Value}" />
|
||||||
|
<u:Divider Content="Demo" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1">
|
||||||
|
<u:Divider Content="{Binding #input.Value, StringFormat='Int = {0}'}" />
|
||||||
|
<u:NumericIntUpDown
|
||||||
|
Name="input"
|
||||||
|
Classes="ClearButton"
|
||||||
|
InnerLeftContent="Age"
|
||||||
|
Step="1"
|
||||||
|
Watermark="Input Value"
|
||||||
|
Value="2" />
|
||||||
|
<u:Divider Content="{Binding #inputDouble.Value, StringFormat='Double = {0}'}" />
|
||||||
|
<u:NumericDoubleUpDown
|
||||||
|
Name="inputDouble"
|
||||||
|
EmptyInputValue="1"
|
||||||
|
Step="0.5"
|
||||||
|
Value="3.1" />
|
||||||
|
<u:Divider Content="{Binding #inputByte.Value, StringFormat='Byte = {0}'}" />
|
||||||
|
<u:NumericByteUpDown
|
||||||
|
Name="inputByte"
|
||||||
|
EmptyInputValue="1"
|
||||||
|
Step="1"
|
||||||
|
Value="3" />
|
||||||
|
<u:Divider Content="{Binding #Drag_Int.Value, StringFormat='Drag Int = {0}'}" />
|
||||||
|
<u:NumericIntUpDown
|
||||||
|
Name="Drag_Int"
|
||||||
|
AllowDrag="True"
|
||||||
|
InnerLeftContent="Drag"
|
||||||
|
Step="1"
|
||||||
|
Watermark="Input Value"
|
||||||
|
Value="2" />
|
||||||
|
|
||||||
|
<!-- hex demo -->
|
||||||
|
|
||||||
|
<u:Divider Content="{Binding #uint_HexNumber.Value, StringFormat='Don‘t Use = {0}, hex={0:X}'}" />
|
||||||
|
<!-- =================this is error usage -->
|
||||||
|
<u:NumericUIntUpDown
|
||||||
|
Name="uint_HexNumber"
|
||||||
|
AllowDrag="False"
|
||||||
|
FormatString="{}{0:X8}"
|
||||||
|
InnerLeftContent="HexNumber"
|
||||||
|
ParsingNumberStyle="HexNumber"
|
||||||
|
Step="1"
|
||||||
|
Watermark="Input Value"
|
||||||
|
Value="2" />
|
||||||
|
|
||||||
|
<!-- =================we should use AllowHexSpecifier -->
|
||||||
|
<u:Divider Content="{Binding #uint_AllowHexSpecifier.Value, StringFormat='uint = {0}, hex={0:X}'}" />
|
||||||
|
<u:NumericUIntUpDown
|
||||||
|
Name="uint_AllowHexSpecifier"
|
||||||
|
HorizontalContentAlignment="Right"
|
||||||
|
AllowDrag="False"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
FormatString="{}{0:X8}"
|
||||||
|
InnerLeftContent="AllowHexSpecifier"
|
||||||
|
ParsingNumberStyle="AllowHexSpecifier"
|
||||||
|
Step="1"
|
||||||
|
Watermark="AllowHexSpecifier"
|
||||||
|
Value="2" />
|
||||||
|
|
||||||
|
<u:Divider Content="{Binding #Consolas_uint.Value, StringFormat='Font=Consolas {0}, hex={0:X}'}" />
|
||||||
|
<u:NumericUIntUpDown
|
||||||
|
Name="Consolas_uint"
|
||||||
|
HorizontalContentAlignment="Right"
|
||||||
|
AllowDrag="False"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
FormatString="X8"
|
||||||
|
InnerLeftContent="0x"
|
||||||
|
ParsingNumberStyle="AllowHexSpecifier"
|
||||||
|
Step="1"
|
||||||
|
Watermark="AllowHexSpecifier"
|
||||||
|
Value="2" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<StackPanel Grid.Column="1" HorizontalAlignment="Left">
|
||||||
|
|
||||||
|
<Label Content="FontFamily" />
|
||||||
|
<TextBox Text="{Binding FontFamily}" />
|
||||||
|
|
||||||
|
<Label Content="AllowDrag" />
|
||||||
|
<CheckBox IsChecked="{Binding AllowDrag}" />
|
||||||
|
|
||||||
|
<Label Content="IsReadOnly" />
|
||||||
|
<CheckBox IsChecked="{Binding IsReadOnly}" />
|
||||||
|
|
||||||
|
<Label Content="HorizontalContentAlignment" />
|
||||||
|
<ComboBox ItemsSource="{Binding Array_HorizontalContentAlignment}" SelectedItem="{Binding HorizontalContentAlignment}" />
|
||||||
|
|
||||||
|
<Label Content="InnerLeftContent" />
|
||||||
|
<TextBox Text="{Binding InnerLeftContent}" />
|
||||||
|
|
||||||
|
|
||||||
|
<Label Content="Watermark" />
|
||||||
|
<TextBox Text="{Binding Watermark}" />
|
||||||
|
|
||||||
|
|
||||||
|
<Label Content="FormatString" />
|
||||||
|
<TextBox
|
||||||
|
MinWidth="100"
|
||||||
|
MaxLength="100"
|
||||||
|
Text="{Binding FormatString}" />
|
||||||
|
|
||||||
|
<Label Content="ParsingNumberStyle" />
|
||||||
|
<ComboBox ItemsSource="{Binding Array_ParsingNumberStyle}" SelectedItem="{Binding ParsingNumberStyle}" />
|
||||||
|
|
||||||
|
|
||||||
|
<Label Content="AllowSpin" />
|
||||||
|
<CheckBox IsChecked="{Binding AllowSpin}" />
|
||||||
|
|
||||||
|
<Label Content="ShowButtonSpinner" />
|
||||||
|
<CheckBox IsChecked="{Binding ShowButtonSpinner}" />
|
||||||
|
|
||||||
|
<u:NumericUIntUpDown
|
||||||
|
Name="nudV"
|
||||||
|
AllowSpin="True"
|
||||||
|
InnerLeftContent="Value"
|
||||||
|
IsEnabled="True"
|
||||||
|
IsReadOnly="False"
|
||||||
|
Value="{Binding Value, Mode=TwoWay}" />
|
||||||
|
|
||||||
|
<u:NumericUIntUpDown InnerLeftContent="Max" Value="{Binding Maximum}" />
|
||||||
|
|
||||||
|
<u:NumericUIntUpDown InnerLeftContent="Min" Value="{Binding Minimum}" />
|
||||||
|
|
||||||
|
<Label Content="Step" />
|
||||||
|
<Slider Minimum="1" Value="{Binding Step}" />
|
||||||
|
|
||||||
|
<Label Content="IsEnable" />
|
||||||
|
<CheckBox IsChecked="{Binding IsEnable}" />
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Ursa.Controls;
|
||||||
using Ursa.Demo.ViewModels;
|
using Ursa.Demo.ViewModels;
|
||||||
|
|
||||||
namespace Ursa.Demo.Pages;
|
namespace Ursa.Demo.Pages;
|
||||||
@@ -11,5 +14,12 @@ public partial class NumericUpDownDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DataContext = new NumericUpDownDemoViewModel();
|
DataContext = new NumericUpDownDemoViewModel();
|
||||||
|
numd.ValueChanged += Numd_ValueChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Numd_ValueChanged(object? sender, ValueChangedEventArgs<uint> e)
|
||||||
|
{
|
||||||
|
Trace.WriteLine($"{(sender as NumericUIntUpDown).Name} {e.OldValue} {e.NewValue}");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
||||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.0" />
|
||||||
<PackageReference Include="Semi.Avalonia" Version="11.0.7" />
|
<PackageReference Include="Semi.Avalonia" Version="11.0.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,50 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Layout;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using Ursa.Controls;
|
||||||
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
|
||||||
namespace Ursa.Demo.ViewModels;
|
namespace Ursa.Demo.ViewModels;
|
||||||
|
|
||||||
public class NumericUpDownDemoViewModel: ObservableObject
|
public partial class NumericUpDownDemoViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[ObservableProperty] private uint _Value;
|
||||||
|
[ObservableProperty] private string _FontFamily = "Consolas";
|
||||||
|
[ObservableProperty] private bool _AllowDrag = false;
|
||||||
|
[ObservableProperty] private bool _IsReadOnly = false;
|
||||||
|
|
||||||
|
[ObservableProperty] private Array _Array_HorizontalContentAlignment;
|
||||||
|
[ObservableProperty] private HorizontalAlignment _HorizontalContentAlignment = HorizontalAlignment.Center;
|
||||||
|
[ObservableProperty] private object? _InnerLeftContent = "obj:0x";
|
||||||
|
[ObservableProperty] private string _Watermark = "Water mark showed";
|
||||||
|
[ObservableProperty] private string _FormatString = "X8";
|
||||||
|
[ObservableProperty] private Array _Array_ParsingNumberStyle;
|
||||||
|
[ObservableProperty] private NumberStyles _ParsingNumberStyle = NumberStyles.AllowHexSpecifier;
|
||||||
|
[ObservableProperty] private bool _AllowSpin = true;
|
||||||
|
[ObservableProperty] private bool _ShowButtonSpinner = true;
|
||||||
|
|
||||||
|
[ObservableProperty] private UInt32 _Maximum = UInt32.MaxValue;
|
||||||
|
[ObservableProperty] private UInt32 _Minimum = UInt32.MinValue;
|
||||||
|
[ObservableProperty] private UInt32 _Step = 1;
|
||||||
|
|
||||||
|
[ObservableProperty] private bool _IsEnable = true;
|
||||||
|
|
||||||
|
|
||||||
|
public NumericUpDownDemoViewModel()
|
||||||
|
{
|
||||||
|
Array_HorizontalContentAlignment = Enum.GetValues(typeof(HorizontalAlignment));
|
||||||
|
Array_ParsingNumberStyle = Enum.GetValues(typeof(NumberStyles));
|
||||||
|
NumericUIntUpDown numericUIntUpDown;
|
||||||
|
TextBox textBox;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnValueChanging(uint oldValue, uint newValue)
|
||||||
|
{
|
||||||
|
Console.WriteLine(oldValue);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:u="https://irihi.tech/ursa">
|
xmlns:u="https://irihi.tech/ursa">
|
||||||
<!-- Add Resources Here -->
|
<!-- Add Resources Here -->
|
||||||
|
|
||||||
<ControlTheme x:Key="InputClearButton" TargetType="Button">
|
<ControlTheme x:Key="InputClearButton" TargetType="Button">
|
||||||
<Setter Property="Button.Foreground" Value="{DynamicResource TextBoxButtonDefaultForeground}" />
|
<Setter Property="Button.Foreground" Value="{DynamicResource TextBoxButtonDefaultForeground}" />
|
||||||
<Setter Property="Button.Cursor" Value="Hand" />
|
<Setter Property="Button.Cursor" Value="Hand" />
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<Setter Property="Foreground" Value="{DynamicResource TextBoxButtonPointeroverForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource TextBoxButtonPointeroverForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type u:NumericUpDown}" TargetType="{x:Type u:NumericUpDown}">
|
<ControlTheme x:Key="{x:Type u:NumericUpDown}" TargetType="{x:Type u:NumericUpDown}">
|
||||||
<Setter Property="NumericUpDown.VerticalContentAlignment" Value="Center" />
|
<Setter Property="NumericUpDown.VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="NumericUpDown.CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
|
<Setter Property="NumericUpDown.CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
|
||||||
@@ -35,24 +35,25 @@
|
|||||||
MinWidth="0"
|
MinWidth="0"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
VerticalContentAlignment="Stretch"
|
VerticalContentAlignment="Stretch"
|
||||||
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}"
|
|
||||||
AllowSpin="{TemplateBinding AllowSpin}"
|
AllowSpin="{TemplateBinding AllowSpin}"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}">
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
|
||||||
<Panel>
|
<Panel>
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_TextBox"
|
Name="PART_TextBox"
|
||||||
Height="{TemplateBinding Height}"
|
Height="{TemplateBinding Height}"
|
||||||
MinHeight="{DynamicResource NumericUpDownWrapperDefaultHeight}"
|
MinHeight="{DynamicResource NumericUpDownWrapperDefaultHeight}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
AcceptsReturn="False"
|
AcceptsReturn="False"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
DataValidationErrors.Errors="{ReflectionBinding $parent[NumericUpDown].(DataValidationErrors.Errors)}"
|
DataValidationErrors.Errors="{ReflectionBinding $parent[NumericUpDown].(DataValidationErrors.Errors)}"
|
||||||
FontSize="{TemplateBinding FontSize}"
|
FontSize="{TemplateBinding FontSize}"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
||||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||||
TextWrapping="NoWrap"
|
TextWrapping="NoWrap"
|
||||||
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
|
||||||
Theme="{DynamicResource NonErrorTextBox}"
|
Theme="{DynamicResource NonErrorTextBox}"
|
||||||
Watermark="{TemplateBinding Watermark}" />
|
Watermark="{TemplateBinding Watermark}" />
|
||||||
<Panel
|
<Panel
|
||||||
@@ -64,18 +65,18 @@
|
|||||||
IsVisible="{TemplateBinding AllowDrag}" />
|
IsVisible="{TemplateBinding AllowDrag}" />
|
||||||
<Button
|
<Button
|
||||||
Name="PART_ClearButton"
|
Name="PART_ClearButton"
|
||||||
Command="{Binding $parent[u:NumericUpDown].Clear}"
|
Margin="0,0,8,0"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Margin="0 0 8 0"
|
Command="{Binding $parent[u:NumericUpDown].Clear}"
|
||||||
IsVisible="False"
|
|
||||||
Focusable="False"
|
Focusable="False"
|
||||||
|
IsVisible="False"
|
||||||
Theme="{StaticResource InputClearButton}" />
|
Theme="{StaticResource InputClearButton}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
</ButtonSpinner>
|
</ButtonSpinner>
|
||||||
</DataValidationErrors>
|
</DataValidationErrors>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
<Style Selector="^.clearButton, ^.ClearButton">
|
<Style Selector="^.clearButton, ^.ClearButton">
|
||||||
<Style Selector="^[IsReadOnly=False]:focus /template/ Button#PART_ClearButton">
|
<Style Selector="^[IsReadOnly=False]:focus /template/ Button#PART_ClearButton">
|
||||||
<Setter Property="IsVisible" Value="True" />
|
<Setter Property="IsVisible" Value="True" />
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ public class NumericIntUpDown : NumericUpDownBase<int>
|
|||||||
protected override bool ParseText(string? text, out int number) =>
|
protected override bool ParseText(string? text, out int number) =>
|
||||||
int.TryParse(text, ParsingNumberStyle, NumberFormat, out number);
|
int.TryParse(text, ParsingNumberStyle, NumberFormat, out number);
|
||||||
|
|
||||||
protected override string? ValueToString(int? value) => value?.ToString(FormatString, NumberFormat);
|
protected override string? ValueToString(int? value)
|
||||||
|
{
|
||||||
|
return value?.ToString(FormatString, NumberFormat);
|
||||||
|
}
|
||||||
|
|
||||||
protected override int Zero => 0;
|
protected override int Zero => 0;
|
||||||
|
|
||||||
@@ -27,6 +30,34 @@ public class NumericIntUpDown : NumericUpDownBase<int>
|
|||||||
protected override int? Minus(int? a, int? b) => a - b;
|
protected override int? Minus(int? a, int? b) => a - b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class NumericUIntUpDown : NumericUpDownBase<uint>
|
||||||
|
{
|
||||||
|
protected override Type StyleKeyOverride { get; } = typeof(NumericUpDown);
|
||||||
|
|
||||||
|
static NumericUIntUpDown()
|
||||||
|
{
|
||||||
|
MaximumProperty.OverrideDefaultValue<NumericUIntUpDown>(uint.MaxValue);
|
||||||
|
MinimumProperty.OverrideDefaultValue<NumericUIntUpDown>(uint.MinValue);
|
||||||
|
StepProperty.OverrideDefaultValue<NumericUIntUpDown>(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool ParseText(string? text, out uint number)
|
||||||
|
{
|
||||||
|
return uint.TryParse(text, ParsingNumberStyle, NumberFormat, out number);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string? ValueToString(uint? value)
|
||||||
|
{
|
||||||
|
return value?.ToString(FormatString, NumberFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override uint Zero => 0;
|
||||||
|
|
||||||
|
protected override uint? Add(uint? a, uint? b) => a + b;
|
||||||
|
|
||||||
|
protected override uint? Minus(uint? a, uint? b) => a - b;
|
||||||
|
}
|
||||||
|
|
||||||
public class NumericDoubleUpDown : NumericUpDownBase<double>
|
public class NumericDoubleUpDown : NumericUpDownBase<double>
|
||||||
{
|
{
|
||||||
protected override Type StyleKeyOverride { get; } = typeof(NumericUpDown);
|
protected override Type StyleKeyOverride { get; } = typeof(NumericUpDown);
|
||||||
@@ -68,9 +99,9 @@ public class NumericByteUpDown : NumericUpDownBase<byte>
|
|||||||
|
|
||||||
protected override byte Zero => 0;
|
protected override byte Zero => 0;
|
||||||
|
|
||||||
protected override byte? Add(byte? a, byte? b) => (byte?) (a + b);
|
protected override byte? Add(byte? a, byte? b) => (byte?)(a + b);
|
||||||
|
|
||||||
protected override byte? Minus(byte? a, byte? b) => (byte?) (a - b);
|
protected override byte? Minus(byte? a, byte? b) => (byte?)(a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NumericSByteUpDown : NumericUpDownBase<sbyte>
|
public class NumericSByteUpDown : NumericUpDownBase<sbyte>
|
||||||
@@ -91,9 +122,9 @@ public class NumericSByteUpDown : NumericUpDownBase<sbyte>
|
|||||||
|
|
||||||
protected override sbyte Zero => 0;
|
protected override sbyte Zero => 0;
|
||||||
|
|
||||||
protected override sbyte? Add(sbyte? a, sbyte? b) => (sbyte?) (a + b);
|
protected override sbyte? Add(sbyte? a, sbyte? b) => (sbyte?)(a + b);
|
||||||
|
|
||||||
protected override sbyte? Minus(sbyte? a, sbyte? b) => (sbyte?) (a - b);
|
protected override sbyte? Minus(sbyte? a, sbyte? b) => (sbyte?)(a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NumericShortUpDown : NumericUpDownBase<short>
|
public class NumericShortUpDown : NumericUpDownBase<short>
|
||||||
@@ -114,9 +145,9 @@ public class NumericShortUpDown : NumericUpDownBase<short>
|
|||||||
|
|
||||||
protected override short Zero => 0;
|
protected override short Zero => 0;
|
||||||
|
|
||||||
protected override short? Add(short? a, short? b) => (short?) (a + b);
|
protected override short? Add(short? a, short? b) => (short?)(a + b);
|
||||||
|
|
||||||
protected override short? Minus(short? a, short? b) => (short?) (a - b);
|
protected override short? Minus(short? a, short? b) => (short?)(a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NumericUShortUpDown : NumericUpDownBase<ushort>
|
public class NumericUShortUpDown : NumericUpDownBase<ushort>
|
||||||
@@ -137,9 +168,9 @@ public class NumericUShortUpDown : NumericUpDownBase<ushort>
|
|||||||
|
|
||||||
protected override ushort Zero => 0;
|
protected override ushort Zero => 0;
|
||||||
|
|
||||||
protected override ushort? Add(ushort? a, ushort? b) => (ushort?) (a + b);
|
protected override ushort? Add(ushort? a, ushort? b) => (ushort?)(a + b);
|
||||||
|
|
||||||
protected override ushort? Minus(ushort? a, ushort? b) => (ushort?) (a - b);
|
protected override ushort? Minus(ushort? a, ushort? b) => (ushort?)(a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NumericLongUpDown : NumericUpDownBase<long>
|
public class NumericLongUpDown : NumericUpDownBase<long>
|
||||||
@@ -233,4 +264,3 @@ public class NumericDecimalUpDown : NumericUpDownBase<decimal>
|
|||||||
|
|
||||||
protected override decimal? Minus(decimal? a, decimal? b) => a - b;
|
protected override decimal? Minus(decimal? a, decimal? b) => a - b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user