Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
845
How To Display Zeros As Zeros?
posted

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,

Parents
No Data
Reply
  • 845
    posted

    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?

Children