feat: support inner left content, fix formatting bug.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<u:NumericIntUpDown Name="input" Step="1" Value="2" Watermark="Input Value" Classes="ClearButton" />
|
||||
<u:NumericIntUpDown Name="input" InnerLeftContent="Age" Step="1" Value="2" Watermark="Input Value" Classes="ClearButton" />
|
||||
<TextBlock Text="{Binding #input.Value}" ></TextBlock>
|
||||
<u:NumericDoubleUpDown Name="inputDouble" Step="0.5" Value="3.1" EmptyInputValue="1"></u:NumericDoubleUpDown>
|
||||
<TextBlock Text="{Binding #inputDouble.Value}"></TextBlock>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
TextWrapping="NoWrap"
|
||||
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
Watermark="{TemplateBinding Watermark}" />
|
||||
<Panel
|
||||
|
||||
@@ -44,8 +44,7 @@ public class NumericDoubleUpDown : NumericUpDownBase<double>
|
||||
|
||||
protected override bool ParseText(string? text, out double? number)
|
||||
{
|
||||
// Weird bug
|
||||
var result = double.TryParse(text, out var value);
|
||||
var result = double.TryParse(text, ParsingNumberStyle, NumberFormat, out var value);
|
||||
number = value;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public abstract class NumericUpDown : TemplatedControl
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<NumberStyles> ParsingNumberStyleProperty = AvaloniaProperty.Register<NumericUpDown, NumberStyles>(
|
||||
nameof(ParsingNumberStyle));
|
||||
nameof(ParsingNumberStyle), defaultValue: NumberStyles.Any);
|
||||
|
||||
public NumberStyles ParsingNumberStyle
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user