I am binding an object to a XamDataPresenter and one of the properties is of decimal type. At run-time, it displays with commas separating the thousands and a dollar in front of the value. How do I stop this?
I tried explicitly defining the field, but this didn't help:
<igData:XamDataPresenter Name="dpMyData" DataSource="{Binding}"> <igData:XamDataPresenter.FieldLayoutSettings> <igData:FieldLayoutSettings AutoGenerateFields="False" /> </igData:XamDataPresenter.FieldLayoutSettings> <igData:XamDataPresenter.FieldLayouts> <igData:FieldLayout> <igData:FieldLayout.Fields> <igData:Field Name="MyField" DataType="{x:Type sys:Decimal}" /> </igData:FieldLayout.Fields> </igData:FieldLayout> </igData:XamDataPresenter.FieldLayouts></igData:XamDataPresenter>
Hello,
This is because the default XamEditor for fields of type decimal is XamCurrencyEditor and this is the reason of the currency symbol and the commas.
To void that you have to register new XamEditor for this field. Here is a thread in the forum that I answered a similar question.
http://forums.infragistics.com/forums/p/20591/74287.aspx#74287
Hope this helps
Alex.
Hi Alex,
Thanks for your help here. I had a reply from Infragistics Developer Support, which is probably along the lines of your other thread where you answered a similar question. They said:
The reason you are getting the currency symbol in your decimal field is because the default editor for a decimal field in the XamDataGrid is the XamCurrencyEditor. However, you can change this by setting the Field's EditorType property to use the XamNumericEditor. You can use the following xaml code snippet:
<igData:XamDataGrid Margin="31,12,56,43" Name="xamDataPresenter1" > <igData:XamDataGrid.FieldLayoutSettings> <igData:FieldLayoutSettings AutoGenerateFields="False" /> </igData:XamDataGrid.FieldLayoutSettings> <igData:XamDataGrid.FieldLayouts> <igData:FieldLayout> <igData:FieldLayout.Fields> <igData:Field Name="MyField"> <igData:Field.Settings> <igData:FieldSettings EditorType="{x:Type igEditors:XamNumericEditor}" EditAsType="{x:Type sys:Double}" /> </igData:Field.Settings> </igData:Field> <igData:Field Name="Name" /> </igData:FieldLayout.Fields> </igData:FieldLayout> </igData:XamDataGrid.FieldLayouts> </igData:XamDataGrid>
For more Information you may refer the following online help article:
<http://help.infragistics.com/Help/NetAdvantage/WPF/2008.2/CLR3.X/html/xamData_Default_Editor_Types_for_Different_Data_Types.html>