fix multiple cursors in extended textbox.
MODIFY
WalletWasabi.Gui/Controls/ExtendedTextBox.cs
WalletWasabi.Gui/Controls/ExtendedTextBox.cs
using Avalonia;
using Avalonia.Controls;
+using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Input.Platform;
@@ -20,6 +21,7 @@ namespace WalletWasabi.Gui.Controls
{
public class ExtendedTextBox : TextBox, IStyleable
{
+ private TextPresenter _presenter;
private MenuItem _pasteItem = null;
private Subject<string> _textPasted;
@@ -177,6 +179,8 @@ namespace WalletWasabi.Gui.Controls
{
base.OnTemplateApplied(e);
+ _presenter = e.NameScope.Get<TextPresenter>("PART_TextPresenter");
+
ContextMenu = new ContextMenu
{
DataContext = this,
@@ -199,12 +203,11 @@ namespace WalletWasabi.Gui.Controls
protected override void OnLostFocus(RoutedEventArgs e)
{
// Dispatch so that if there is a context menu, it can open before the selection gets cleared.
- // This is a workaround, fix inside avalonia to come in next release.
Dispatcher.UIThread.PostLogException(() =>
{
if (ContextMenu != null && ContextMenu.IsOpen)
{
- // Do not call base method, as this will clear selection.
+ _presenter?.HideCaret();
}
else
{

fix multiple cursors in extended textbox.