I started maintenance on some poorly written XAMLs. I am relatively new to XAML.
One thing I need is - grid columns should automatically adjust their width per the text contents.
The MSDN documentation on GridViewColumn.Width says - set it to Auto to enable auto-sizing behavior. However even though the code reads as follows, column widths remain the same irrespective of the content text.
<ListView.View>
<GridView>
<GridViewColumn x:Name="lstColName" Width="200">Name</GridViewColumn>
<GridViewColumn x:Name="lstColPath" Width="Auto">Path</GridViewColumn>
</GridView>
</ListView.View>
The GridView recalculates column content sizes only when the template or internal column collection change, that's why Width="Auto" only works on loading the GridView.
Here's an article about a possible approach to a solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With