I have a question regarding a GridViewMaskedInputColumn with a MaskType = MaskType.Numeric with a short width, so I'll place this question under this forum.
When I focus on the cell the caret seems to be placed at the beginning of the content, and (a) happens (see attached file). I wanted to achieve something like (b).
I inherited GridViewMaskedInputColumn and if I do:
public class SomeGridViewMaskedInputColumn : GridViewMaskedInputColumn
{
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
{
var elem = (RadMaskedNumericInput)base.CreateCellEditElement(cell, dataItem);
elem.GotFocus += Elem_GotFocus;
// I tried SetCaretToEndOfTextOnFocus(elem, true); but it doesnt work for some reason
return elem;
}
private void Elem_GotFocus(object sender, RoutedEventArgs e)
{
var control = ((RadMaskedNumericInput)sender);
control.SelectionStart = control.Text.IndexOf(",");
}
}
(c) happens. In fact, (b) looks only achievable if i set SelectionStart to control.Text.Length and then press left 2 times (in this case, because i have 2 decimal places). Is there a better way of doing this?