I am using Infragistics WPF 2013.1.2204.
I have a Field of type decimal that contains zeros. However, in the XamDataGrid, those zeros appear as blank cells. How do I make the zeros show up?
I have other columns of type decimal that contain null values. In the XamDataGrid, they appears as blanks, which is what I want.
Kind Regards,
Aha! Setting the following Format mask does the trick!
es.Setters.Add(new Setter(XamNumericEditor.FormatProperty, "#,##0.00"));
Let me give some more details on my situation.
I have AutoGenerateFields set to true. I want to display decimal numbers in some columns in my grid, but without the $ sign that automatically gets created. My other requirements are that 0 values appear as 0 and null values appears as blank.
Following the recommendation in http://ko.infragistics.com/community/forums/t/46529.aspx I handle they OnFieldLayoutInitialized event with the following code:
foreach (Field field in e.FieldLayout.Fields) { if (field.DataType == typeof(decimal)) { Style es = new Style(); es.TargetType = typeof(XamNumericEditor); es.Setters.Add(new Setter(XamNumericEditor.FormatProperty, ".###"));
field.Settings.EditorStyle = es; } }
This code removed the $ sign from the values. Great! However, now I am finding that 0 values are appearing as blanks.
How can I display decimal numbers without a $ sign and have zeroes appears zeroes and nulls appear as blanks?