feat: update property name.

This commit is contained in:
rabbitism
2024-01-14 23:33:36 +08:00
parent fecf22a5ec
commit 0f3883ed66
3 changed files with 8 additions and 8 deletions

View File

@@ -21,6 +21,6 @@
<u:NumericByteUpDown Name="inputByte" Step="1" Value="3" EmptyInputValue="1"></u:NumericByteUpDown> <u:NumericByteUpDown Name="inputByte" Step="1" Value="3" EmptyInputValue="1"></u:NumericByteUpDown>
<TextBlock Text="{Binding #inputByte.Value}"></TextBlock> <TextBlock Text="{Binding #inputByte.Value}"></TextBlock>
<TextBlock Text="Drag"></TextBlock> <TextBlock Text="Drag"></TextBlock>
<u:NumericIntUpDown Step="1" Value="2" Watermark="Input Value" TextEditable="False" /> <u:NumericIntUpDown Step="1" Value="2" Watermark="Input Value" IsTextEditable="False" />
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@@ -38,7 +38,7 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Background="Transparent" Background="Transparent"
Cursor="SizeAll" Cursor="SizeAll"
IsVisible="{TemplateBinding TextEditable, IsVisible="{TemplateBinding IsTextEditable,
Converter={x:Static BoolConverters.Not}}" /> Converter={x:Static BoolConverters.Not}}" />
</Panel> </Panel>
</ButtonSpinner> </ButtonSpinner>

View File

@@ -27,13 +27,13 @@ public abstract class NumericUpDown : TemplatedControl
private Point? _point; private Point? _point;
protected internal bool _updateFromTextInput; protected internal bool _updateFromTextInput;
public static readonly StyledProperty<bool> TextEditableProperty = AvaloniaProperty.Register<NumericUpDown, bool>( public static readonly StyledProperty<bool> IsTextEditableProperty = AvaloniaProperty.Register<NumericUpDown, bool>(
nameof(TextEditable), defaultValue: true); nameof(IsTextEditable), defaultValue: true);
public bool TextEditable public bool IsTextEditable
{ {
get => GetValue(TextEditableProperty); get => GetValue(IsTextEditableProperty);
set => SetValue(TextEditableProperty, value); set => SetValue(IsTextEditableProperty, value);
} }
public static readonly StyledProperty<bool> IsReadOnlyProperty = AvaloniaProperty.Register<NumericUpDown, bool>( public static readonly StyledProperty<bool> IsReadOnlyProperty = AvaloniaProperty.Register<NumericUpDown, bool>(
@@ -207,7 +207,7 @@ public abstract class NumericUpDown : TemplatedControl
private void OnDragPanelPointerMoved(object sender, PointerEventArgs e) private void OnDragPanelPointerMoved(object sender, PointerEventArgs e)
{ {
if (TextEditable) return; if (IsTextEditable) return;
if(!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; if(!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
var point = e.GetPosition(this); var point = e.GetPosition(this);
var delta = point - _point; var delta = point - _point;