Skip to content
Permalink
Browse files

Handling mouse cursor according to paste, select all or normal textbo…

…x operation
  • Loading branch information...
molnard committed Nov 10, 2018
1 parent 2b50bc9 commit 73a7699a2a35979b112cbabb97198c1250ba8e79
Showing with 26 additions and 1 deletion.
  1. +26 −1 WalletWasabi.Gui/Behaviors/PasteAddressOnClickBehavior.cs
@@ -35,16 +35,19 @@ private TextBoxState MyTextBoxState
{
ToolTip.SetTip(AssociatedObject, _originalToolTipText);
ToolTip.SetIsOpen(AssociatedObject, false);
AssociatedObject.Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Ibeam);
}
break;
case TextBoxState.AddressInsert:
{
ToolTip.SetTip(AssociatedObject, "Click to paste address from clipboard");
AssociatedObject.Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Arrow);
}
break;
case TextBoxState.SelectAll:
{
ToolTip.SetTip(AssociatedObject, "Click to select all");
AssociatedObject.Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Arrow);
}
break;

@@ -86,7 +89,29 @@ protected override void OnAttached()
})
};


_disposables.Add(
AssociatedObject.GetObservable(TextBox.PointerMovedEvent).Subscribe(pointer =>
{
switch (MyTextBoxState)
{
case TextBoxState.NormalTextBoxOperation:
{
AssociatedObject.Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Ibeam);
}
break;
case TextBoxState.AddressInsert:
{
AssociatedObject.Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Arrow);
}
break;
case TextBoxState.SelectAll:
{
AssociatedObject.Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Arrow);
}
break;
}
})
);

_disposables.Add(
AssociatedObject.GetObservable(TextBox.PointerReleasedEvent).Subscribe(pointer =>

0 comments on commit 73a7699

Please sign in to comment.
You can’t perform that action at this time.