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
70
Field Auto Discovery
posted

Quick Question - Can I apply an attribute to an object property to change how it appears in the header of the grid e.g. changing OrderId to "Order ID"?

 private int orderId;

[SomeAttributeMethod(FieldName="Order ID")]
public int OrderId
  {
            get { return orderId; }
            set { orderId = value; }
  }


  • 6867
    posted

     You can set the Label property of a Field to user-friendly display text, as opposed to the property name.  There is no inherent support in the XamDataGrid for reading metadata off a property to discover the Label, though you can certainly submit that as a feature request via the Developer Support group.  If you are dynamically generating FieldLayouts (and their Fields) you can read that metadata yourself and set each Field's Label.