AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.05k stars 2.25k forks source link

Impove TextBox selection handling #11693

Open rabbitism opened 1 year ago

rabbitism commented 1 year ago

Is your feature request related to a problem? Please describe. in WPF, TextBox text selection remains opon lost focus, while in Avalonia text selection is cleared. in WPF there is a SelectionChanged event.

Describe the solution you'd like

  1. There should be a property ClearSelectionOnLostFocus, by default false, and allows user to keep the selected text.
  2. Add SelectionChanged event

Describe alternatives you've considered

Additional context In WPF, TextBox selection is kept on lostfocus by default. Although visually it's not, it is selected in fact. There is a property IsInactiveSelectionHighlightEnabled, which controls the visual of selected text. If this is set to true, selected text will be grayed.

kulikov-dev commented 8 months ago

At least it would be nice to have SelectionTextProperty, so we can track it on PropertyChangedevent. Right now we have only SelectionStartPropertyand SelectionEndProperty.