I have Rad Mask TextBox and a button. So user can enter any case into the text box. when button is clicked, I am fetching some record based on text and event I have to change the text to upper, trim and position the caret to end.
I noticed, if upper case is entered, I get all the scenario's but when lower case is entered the postion of cursor is pointed to beginning.
this is what I tried.
txtSearch.MaskedText = txtSearch.MaskedText.ToUpperInvariant().Trim();
txtSearch.SelectionOnFocus = SelectionOnFocus.CaretToEnd;
I really appreciate your help.
SelectionStart has solved the requirement.
Dispatcher.BeginInvoke(() =>
{
if (txtSearch.MaskedText != null)
{
txtSearch.MaskedText = txtSearch.MaskedText.ToUpper();
txtSearch.SelectionStart = txtSearch.MaskedText.Length;
txtSearch.Focus();
}
});