Keep Silverlight TextBox highlighting out of focus yet?

As stated, and basically I wanted to do the same thing that this is for WPF , but in Silverlight instead.

But in my TextBox.LostFocus event there is no e.Handled. And I also tried using VisualStateManger.GoToState for focused state:

VisualStateManager.GoToState(TextBox1, "Focused", false); TextBox1.SelectionStart = 0; TextBox1.SelectionLength = 3; TextBox1.SelectionForeground = new SolidColorBrush(Colors.Orange); 

But that doesn't work either.

Is there a workaround?

+4
source share
1 answer

The following code will select everything in focus.

 TextBox1.Select(0, TextBox1.Text.Length); 

Perhaps using this method to select a choice. If the selection is not saved, try to save the position and length of the carriage in a temporary variable (within the class of a custom text field).

0
source

Source: https://habr.com/ru/post/1433664/


All Articles