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
500
How to set column widths
posted

How do I programmatically set the widths for columns on a XamDataGrid after the data source has been assigned?  I need to do this from code, not xaml ...

  • 4850
    Offline posted

    Listen to the FieldLayoutInitialized event. You can access all the fields from the FieldLayout's Fields collection. Then set the CellWidth and LabelWidth of each field thru its Settings object, e.g.

    e.FieldLayout.Fields[0].Settings.CellWidth = 75;

    e.FieldLayout.Fields[0].Settings.LabelWidth = 75;