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
25
How to make all columns size to accommodate all content when binding
posted

Hi,

I have a XamDataGrid that I am binding to a DataTable. I don't have explicit column definitions, rather the grid is inferring this from the DataTable.

I've spent the best part of a day now trying to make the columns auto-size automatically. I want all the content for all rows (if they're on screen or not) to be taken into consideration and the column widths be set automatically.

If there's not a property I can set on the grid, then I could do this in code behind and handle a grid event (although with it being MVVM I'd prefer to do it in XAML).

Please let me know how I can achieve this. I have tried AutoSizeScope and AutoSizeOptions, but they don't appear to do anything.

We're using v9.2 of the grid.

Thanks.

  • 5124
    posted

    Hi Michael,

    I discussed this briefly with our engineers.  If the XamDataGrid doesn't know about the size of all of the data elements in the DataTable, there's no way to configure it automatically as you described.  I am not aware of a way to achieve this functionality.

    I will try to keep my eye on this thread in case you have further questions.

    Thanks,