Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4155
How change XamCurrencyEditor's default cursor position to $ instead of cents when GotFocus?
posted

I am using the following to selectAll text when the XamCurrencyEditor gets focus, but the cursor is defaulted to the "cents" part of the editor.  This results in the SpinButtons adjusting the cents portion of the amount, but i would like it to default to adjust the $ portion instead.  When a user focuses the editor with $10.00 displayed, and clicks "UP", I want it to become $11.00, not $10.01.  How can I accomplish this?

In XamCurrencyEditor's XAML: GotFocus="XamCurrencyEditorGotFocus"
code-behind:

private void XamCurrencyEditorGotFocus(object sender, RoutedEventArgs e)
        {
            XamCurrencyEditor currencyEditor = sender as XamCurrencyEditor;
 
            if (currencyEditor != null)
            {
                if (!String.IsNullOrEmpty(currencyEditor.Text))
                {
                    currencyEditor.SelectAll();
                }
            }
        }

Parents
  • 5600
    Offline posted

    Hello Travis,

    You can try to use the SelectionStart property. You can add this line of code below SelectAll() method:

    currencyEditor.SelectionStart = 0;


    Hope this will help you.

    Regards,

    Anastas

Reply Children