Browse Source

dont allow text selection to be lost when context menu is opened... i.e. for copy and paste to work.

pull/4498/head
Dan Walmsley 6 years ago
parent
commit
54cedcea87
  1. 3
      src/Avalonia.Controls/ContextMenu.cs
  2. 11
      src/Avalonia.Controls/TextBox.cs

3
src/Avalonia.Controls/ContextMenu.cs

@ -280,9 +280,8 @@ namespace Avalonia.Controls
}
_popup.Child = this;
_popup.IsOpen = true;
IsOpen = true;
_popup.IsOpen = true;
RaiseEvent(new RoutedEventArgs
{

11
src/Avalonia.Controls/TextBox.cs

@ -410,10 +410,15 @@ namespace Avalonia.Controls
protected override void OnLostFocus(RoutedEventArgs e)
{
base.OnLostFocus(e);
SelectionStart = 0;
SelectionEnd = 0;
if (ContextMenu == null || !ContextMenu.IsOpen)
{
SelectionStart = 0;
SelectionEnd = 0;
RevealPassword = false;
}
_presenter?.HideCaret();
RevealPassword = false;
}
protected override void OnTextInput(TextInputEventArgs e)

Loading…
Cancel
Save