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
255
XamCurrencyEditor and input
posted

Hi, 

We are using a XamCurrencyEditor which has the following properties set:

PromptChar = ' ';
FormatProvider = new CultureInfo("en-US");
Mask = "{double:-12.0}";

We are also overriding the OnKeyUp:

protected override void OnKeyUp(KeyEventArgs e)
{

if (e.Key == Key.K)
Text += "000";
else if (e.Key == Key.M)
Text += "000000";

base.OnKeyUp(e);

}

The XamCurrencyEditor works as expected when I manually type in the numbers and the negative sign, but when I push the K or M buttons it will break the mask.  

For example, if I were to type 1, then hold down M instead of it reaching the max of 100,000,000,000 it will actually go to 1000,000,000,000 (1 + the value in mask).  Now it won't let me leave the editor, but obviously I don't want it look like this.

I've tried handling different events but that did not work.

If I remove the "-" from the Mask, everything works fine.

The only ugly way I can get this to work is by parsing out the value in the mask and adding some conditionals for when to add to the Text.

Any ideas on how I can get this working in a cleaner way?

Thanks in advance for looking at my question.