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.
<Style x:Key="Digit2DecimalFormatStyle" TargetType="{x:Type igEditors:XamNumericEditor }"><Setter Property="Format" Value ="9999.##" /></Style >
Please, assist me on this. I want the first 4 numerics optional with two decimal places always shown. This is not working. It shows 9999.17 when my value is 17.00. So I want the result to be 17.00 in the field. By the way, the example above just happens to be the last attempt I made. I tried your suggestion as follows and ended up with: {double:4172} as my value.
<Style x:Key="Digit2DecimalFormatStyle" TargetType="{x:Type igEditors:XamNumericEditor }"><Setter Property="Format" Value ="{}{double:4.2}"/></Style >
Thanks,
You are setting the Format property - I mentioned the Mask property. The Format property uses the .net format string characters; 9 is not a valid character for numeric formats. The ms documentation lists all the valid numeric format characters here.
Sorry about that. I'm a twit. :) Switching to Mask worked.
BTW: I was looking at the Masks documentation which suggested:
Obviously I need to pay more attention to the context of things. Nonetheless, this is the solution I needed. Greatly appreciated.
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.
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 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.