Hi there,
for most cases AutoFit-Layout in WinGrid works fine. But sometimes we have columns that should have a fixed width combined with columns that should use most of the available space.
Is a layout as shown in the image below possible to achieve with WinGrid?
Under the columns I have written the desired column settings. 9 columns have a fixed width. One column should 33%, another should take 66% of the available rest.
Thanks for any help.
Achim
Ok thank you all for your help. I'll try both solutions.
- Achim
There's no weight, exactly. But if you set AutoSizeMode to ResizeAllColumns, then the remaining columns will be size proportionally, based on their initial widths.
Another option would be to use RowLayouts, which actually does let you specify WeightX and WeightY on each column.
You can calculate the rest width. Then restWidth*0.33 and restWidth*0.66 for your sepecified column. If the Grid size can be changed, you can re-calculate the restWidth in SizeChanged event...
Thank you Mike. This works fine for me.
The only question I have left is: can I specify a "column weight" for the flexible columns?
Hi,
Yes, I think this should be possible. What you do is set MinWidth and MaxWidth on the columns you want fixed. You would, of course, set both properties to the same value, to lock the column into a fixed width. The other (sizable) columns will be the only ones that size by AutoFit.