Syncfusion MAUI DataGrid auto sizing columns
Recently, I had a project in which one of the requirements was that it should run both in PCs and Macs.
After some research I decided to lever up my knowledge of .NET and use MAUI (Multiplatform App User Interface) to accomplish this.
I was (and is -- as I write this I'm still writing the app) a learning curve. I had to learn a whole new way to do things. Things that were simple in my WinForms days are somewhat complex and clunky.
But that's a story for another post.
One of the things I had to use was a data grid. Because I already had the license to Syncfusion controls, I decided to use their MAUI versions on this app.
Everything worked, more or less as expected... except the auto resizing of columns.
To effectively accomplish this, I had to do something like this:
MyDataGrid.ColumnWidthMode = ColumnWidthMode.None;
/*
* Update the data source
*/
MyDataGrid.ColumnWidthMode = ColumnWidthMode.FitByCell;
Only after that was that the column would correctly resize.
Comments
Post a Comment