Search code examples
c#.netwpfxaml.net-core

How to iterate through gridviewcolumns and set the width depending on the window width?


GridViewColumn width calculation

I want to save the width of a column to user.config, when the user adjust the column it will be saved when the application is closed. Each column has its own setting in the user.config, which refers to the fact that I also want to calculate the rest of the columns when there is only one setting for a column, so that everything is in proportion to the window width, so each colum has same size.

this picture should help to understand what i try to achieve. First row from left to right you see how it should react with no saved values if you expand the width. Second row from left to right you see how it should apply the saved value and calculate the rest columns depending on the increasing size of the window width. enter image description here


Solution

  • I found a way it works fine now.