If I enter a value into a XamNumericEditor that has a mask of {double:4.2}, and I only enter the first four digits and I tab off it, why doesn't the control fill in the decimal places with 0's?
I just leaves and empty place... Any way to fix that?
Hello,
Does setting Mask, Format, and PromptChar like the following example give you the behavior you are looking for:
<igEditors:XamNumericEditor Mask="{}{double:3.0}" Format="000" PromptChar="0"/>
Let me know if you have any questions.
Hi, I'm unable to use the above tip, my xamnumericinput removes the 0s as they are promptchars, so entering '200' gives me 2.
In my case, I just want to have a 3-digit number that fills with 0 no matter what the user adds, so adding '45' displays '045' and adding '202' displays '202', and I want to be able to save the values correctly to 45 and 202 respectively. I've experimented with promptchars and masks of '###', '999' and 'nnn' but they all don't work.
Not really, sorry. I think an image's worth a thousand words, so I've attached what is happening and what I expect.
While the control has focus, it is OK to display prompt chars and it does not matter if "12.3" is typed in without the 0 at the end. However, when the control loses focus, I want it to automatically format to "12.30" (a kind of ValueToDisplayTextConverter). However, no DisplayMode allows to do that.
Here's what I do to edit an amount in CAD$ :
<ig:XamNumericEditor Padding="0,0,15,0" Mask="{}{double:6.2}" ValueType="my:Double" PromptChar=" " ValidationMode="Always" Value="{Binding MONTANT, Mode=TwoWay}" Minimum="0" DisplayMode="{Binding MONTANT, Converter={StaticResource neDisplayModeConverter}}" />
<TextBlock Grid.Row="0" Grid.Column="2" Text="$" Margin="0,0,5,0" HorizontalAlignment="Right" VerticalAlignment="Center" />
And here's the converter that allows to display an empty box instead of " . " when the value is null : public class XamNumericEditorDisplayModeConverter : IValueConverter{public object Convert(object value, Type targetType, object parameter, CultureInfo culture){if (value == null || !(value is double)) return Infragistics.Controls.Editors.MaskMode.Raw;else return Infragistics.Controls.Editors.MaskMode.IncludeLiterals;}...}
Is there any way to use a converter or something else to format the text that represents the value when the control is NOT in edit mode (when it does not have focus) ?
Thanks for your help :)
Remove the PromptChar="0"
You no longer see the 0s but you do see lines for digits.
Or set the PromptChar=" " [space], then all you see is the decimal point.
Take a look, does that help? But as far as I can tell, there is no auto filling for the currency.
Thanks,
Richard
Is there a cleaner way ?
With this workaround, if the user types "12.3" it will display "0012.30" when in fact, we need to display "12.30".
In my case, I use the XamNumericEditor to display currency and percentages, so the decimal numbers are really important (12.30$ versus 12.3$ or 0012.30$)
Any other solution ?
Thank you,