Actually the default EditType for xamNumericEditor is double. The default mask for a double is just "{double}" which defaults to having 9 integer places and the number of fraction places being determined by the NumberDecimalDigits of the culture used. If you want to register a different mask for double you can use the XamMaskedEditor.RegisterDefaultMaskForType static method. The available tokens are listed on this page - http://help.infragistics.com/Help/NetAdvantage/WPF/2008.1/CLR3.X/html/xamEditors_Masks.html.
You could set the Format property to something like "d" for when it is not in edit mode but when you are in edit mode you are going to see all of the mask characters.
Hy Andrew.
I have a question about the format of the XamNumericEditor. I used this mask for double values "{double:-5.3}" and it's working great. The problem I have it's with the CultureInfo from the CurrentThread. In my App.cs file I specified some settings for the CultureInfo
ci.NumberFormat.NumberDecimalSeparator = ",";
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = ci;
The XamNumericEditor allows me the enter only numbers with 5 digits befor the comma and 3 after, which is correct because of the mask, but it will display it with "." as a separator for the digits and "," as separator for group. Shouldn't it take this settings from the CultureInfo? The same happens inside the XamDataGrid, it displays the numbers in the same format and doesn't see the CultureInfo. Is this correct or I am missing somethig?
Thanks very much.
Nico
Actually the culture used by wpf elements is usually based on the XmlLanguage (FrameworkElement.Language). WPF uses the Language property to determine the Culture that should be passed into bindings. I don't believe the Language property allows you to provide a custom provider but you can set the FormatProvider of the editor.
Thanks very much Andrew. Now it's working.
I have a similar issue however I have some columns that need to have two decimal places and others that need three decimal places. How can I accomplish this? Thanks.
I have the same problem. I need to allow up to 12 digits, not counting the decimals. According to your statement regarding Double, it should work, but it doesn't.
I am able to type more than 9 characters into the editor if I set the Mask accordingly, but when I press Enter or focus away from the control, the value is lost if it contains more than 9 digits. Anything up to 9 digits, and the value is preserved in the cell. I am trying XamNumericEditor, XamCurrencyEditor, XamMaskEditor, as well as different data types (double, Int64, currency, etc.)... It makes no difference.
Here is my test control, which is part of a XamDataGrid. Any help will be very appreciated:
<ig:Field Name="Dollars" > <ig:Field.Settings> <ig:FieldSettings AllowEdit="True" EditAsType="{x:Type sys:Double}"> <ig:FieldSettings.EditorStyle> <Style TargetType="{x:Type ig:XamCurrencyEditor}" > <Setter Property="Mask" Value="{}{double:12.0}" /> <Setter Property="Format" Value="C0" /> </Style> </ig:FieldSettings.EditorStyle> </ig:FieldSettings> </ig:Field.Settings> </ig:Field>
Thanks for the reply and the sample project. I was able to run your project and get it to work, even in a XamDataGrid.
However when I am using the exact same approach in my project, the Mask does not work. I looked at the XamNumericEditor rendered by the datagrid using Snoop and compared it with your sample project and they are the exact same. I am really not sure what I am doing wrong here, I tried with different object model as well and different DataSource, same result... this is really weird. I can't send you the project as it is pretty big and it is our customer's project with copyright material.
I will post the solution if I even find it.
A double is only going to support 15 digits of precision so your 17 characters (15.2) will likely loose precision. That being said I am able to enter more than 9 digits. I'm attaching the sample that I'm testing with. Please attach a modified sample that demonstrates the problem if you still have an issue.
I am also looking for setting the Mask for XamNumericEditor to have more than 9 integer digits. Please let me know if anyone got the solution.
Thanks
I came across this thread and I still can't figure out how to allow the XamNumericEditor in a XamDataGrid to allow a number more than 1,999,999,999.99... Here is what I tried with no success:
<Setter Property="Mask" Value="nnn,nnn,nnn,nnn,nnn.nn" />OR<Setter Property="Mask" Value="{}{double:15.2}" />
The 2 solution above creates a mask with the correct number of prompt char but it is still not allowing me to enter more than 10 integer digits.
Anybody has a solution that allow me to enter say 234,567,890,123,456.12 ? Thanks.