fix ui for editable textblock.
MODIFY
WalletWasabi.Gui/Controls/EditableTextBlock.cs
WalletWasabi.Gui/Controls/EditableTextBlock.cs
@@ -113,6 +113,15 @@ namespace WalletWasabi.Gui.Controls
set { SetValue(InEditModeProperty, value); }
}
+ public static readonly StyledProperty<bool> ReadModeProperty =
+ AvaloniaProperty.Register<EditableTextBlock, bool>(nameof(ReadMode), defaultValue:true, defaultBindingMode: BindingMode.TwoWay);
+
+ public bool ReadMode
+ {
+ get { return GetValue(ReadModeProperty); }
+ set { SetValue(ReadModeProperty, value); }
+ }
+
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
{
base.OnTemplateApplied(e);
@@ -153,8 +162,10 @@ namespace WalletWasabi.Gui.Controls
private void EnterEditMode()
{
EditText = Text;
+ ReadMode = false;
InEditMode = true;
+
_root.MouseDevice.Capture(_textBox);
_textBox.CaretIndex = Text.Length;
_textBox.SelectionStart = 0;
@@ -174,6 +185,7 @@ namespace WalletWasabi.Gui.Controls
}
InEditMode = false;
+ ReadMode = true;
_root.MouseDevice.Capture(null);
}
}

MODIFY
WalletWasabi.Gui/Controls/EditableTextBlock.xaml
WalletWasabi.Gui/Controls/EditableTextBlock.xaml
<Setter Property="Template">
<ControlTemplate>
<Grid>
- <TextBlock Text="{TemplateBinding Text}" VerticalAlignment="Center" Name="PART_TextBlock" Margin="1 0 0 0" />
+ <TextBlock Text="{TemplateBinding Text}" IsVisible="{TemplateBinding ReadMode}" VerticalAlignment="Center" Name="PART_TextBlock" Margin="1 0 0 0" />
<TextBox Text="{TemplateBinding EditText, Mode=TwoWay}"
IsVisible="{TemplateBinding InEditMode}"
Name="PART_TextBox"

fix ui for editable textblock.