Home > Blockchain >  WPF control that will adjust column and row count and size automatically based on parent size
WPF control that will adjust column and row count and size automatically based on parent size

Time:09-23

I have 15 checkboxes that I want to put in a control which will arrange them in a way that would adjust for the parent window size.

Meaning if the user resizes it to be 1000 pixels tall and 200 pixels wide, they should be put all in one column, while if he resizes it to be 300 tall and 800 wide, they should be equally spread across as many columns as are needed for the most amount of items to be visible.

It'd like all of that to happen without me writing code for it, i.e. I hope there already is such a control but I've looked at the uniform grid, the items and listbox controls and didn't find how to.

CodePudding user response:

The WrapPanel in WPF is similar to the FlowLayout in WinForms.

It automatically distributes controls based on the available height/width.

https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.wrappanel?redirectedfrom=MSDN&view=windowsdesktop-6.0

  • Related