Automate GridViewColumns programmatically by content
2 answers
I had the same problem, I found a good hint of it here .
This is how I solved the problem.
if ((sender as ListView)?.View is GridView gridview)
{
foreach (var column in gridview.Columns)
{
// Set the Width. Then clear it to cause the autosize.
column.Width = 1;
column.ClearValue(GridViewColumn.WidthProperty);
}
}
+2
source to share