How do I get this listbox to be maxiumum size, i.e. fill the group box its in.
I’ve tried width=”auto” Height=”auto”, width=”stretch” Height=”stretch”
annoyingly at the moment, it dynamicly sizes to whatever fills it – (i cant think of any situation you’d want a listbox to do that but anyway) – or I can only statically set its size.
Cheers!
The problem is that StackPanels try to take up as little space as possible.
Just remove them and you should be fine.
If that doesn’t fit your situation, we’ll need a bit more context on where the ListBox is going.
DockPanels are also good for making controls use up the remaining space. The last item inside a DockPanel uses all the remaining space (as long as you haven’t set LastChildFill = false).
The below example allows the TextBlock to take up as much space as it needs at the top, and then the GroupBox with the ListView takes up the rest.