We’re having a problem with XamCurrencyEditor when its properties are set a specific way.
Here's the problem: If you want to enter only a cents value into the editor (say $0.25), you have to either (a) press decimal point twice or (b) enter a leading zero first. If you press decimal point once, any digits entered are taken as the dollar value.
For example, if I want to enter 25 cents and press decimal point, then 2, then 5, it ignores the decimal point and displays a value of $25.00.
Here's the specific set of property settings that lead to this situation:
This does not happen when PromptChar is something other than null (like the default underscore value) or when SelectAll() isn't called.
Here's some sample XAML/C# to illustrate the scenario:
<igEditors:XamCurrencyEditor x:Name="zzz" Width="150" IsAlwaysInEditMode="True" Value="123.45" />
InitializeComponent();
this.zzz.PromptChar = '\0';this.zzz.SelectAll();
Hi,
Can you please write the exact version of our product. It looks like: 11.2.1012
Because we have a bug for this, and it is fixed in last the ServiceRelease.
Regards,
Anastas
This is happening in version 11.2.20112.2125 of the WPF LOB controls.
If you have a initial value set, as in your case in XAML - Value="132.45", the you have to remove the SelectAll and set InsertMode to false. This will allow you to overwrite the existing numbers without selecting all the content.
The problem which you describing exists when there is no value in the editor. Which can be workaround if you do not use IsAlwaysInEditMode property.
This workaround appears to provide the correct result. Thank you for your help.
Hello,
I can suggest you handle the ‘PreviewKeyDown’ event of the XamCurrencyEditor and in case the decimal point is pressed to position the cursor after the decimal separator like :
this.xamCurrencyEditor1.PromptChar = '\0';
this.xamCurrencyEditor1.IsAlwaysInEditMode = false;
…
private void xamCurrencyEditor1_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Decimal || e.Key == Key.OemPeriod)
xamCurrencyEditor1.SelectionStart = 1;
}
If you need any further assistance on this matter, feel free to ask.
I tried your suggestion of removing the call to SelectAll() and setting InsertMode to false, and that does not produce the same result.
If I configure it the way you suggest, and the editor contains the value 123.45, then I tab into the editor and start typing ".25", it replaces only the cents portion and leaves the original dollar portion. That is not at all the same as overwriting the entire amount. The expectation is that typing ".25" would result in a value of "0.25" in the editor.