I would like to have my xamDataGrid display numeric types as ints for all numerics that are returned in a data table.
Any idea on how to do this?
Today, when I return a values as a numeric, it puts a $ sign in front of the number. I just want to display it as a numeric, with nothing after the period.
Thanks ahead of time.
Jack
In the code I tried putting this in.
Infragistics.Windows.Editors.ValueEditor.RegisterDefaultEditorForType(typeof(decimal), typeof(Infragistics.Windows.Editors.XamNumericEditor), false); Infragistics.Windows.Editors.XamMaskedEditor.RegisterDefaultMaskForType(typeof(decimal), "{Int32}");
it did not work, just put {Int32} wherever I had a numeric value...
When i replaced {Int32} with ################################# it put the right value in, but then, when my numbers get bigger than the number of #####'s it will not work again. It would be much better if i could put a type in.....and then have that type apply no matter how big the number is.
Thanks for the quick reply.
Works for one field change, but my application is kinda different.
I have a universal control that people can use. People will bind datatables into this usercontrol / Grid. The columns in the datatable that are stored as numeric type should be displayed as interger type.
So, you would need to dynamically go through each field supplied by the datatable and see if it is numeric. If so, then display it as an integer.
Any clues on how to do this?
Hello Jack,
There are couple of properties in the FieldSettings that can be used to change the default generated editor in each Field like EditorType and EditAsType.
<igDP:Field Name="Price"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamNumericEditor}" EditAsType="{x:Type sys:Int32}" /> </igDP:Field.Settings>
The default editor for double or decimal values is XamCurrencyEditor, so you can just change it to XamNumericEditor in order to interpret the values as integers.
Let me know if you have any questions with this matter.