add NumericUIntUpDown
This commit is contained in:
@@ -18,7 +18,10 @@ public class NumericIntUpDown : NumericUpDownBase<int>
|
||||
protected override bool ParseText(string? text, out int 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;
|
||||
|
||||
@@ -27,6 +30,34 @@ public class NumericIntUpDown : NumericUpDownBase<int>
|
||||
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>(0);
|
||||
}
|
||||
|
||||
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>
|
||||
{
|
||||
protected override Type StyleKeyOverride { get; } = typeof(NumericUpDown);
|
||||
@@ -233,4 +264,3 @@ public class NumericDecimalUpDown : NumericUpDownBase<decimal>
|
||||
|
||||
protected override decimal? Minus(decimal? a, decimal? b) => a - b;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user