I have a GroupBox inside a DockPanel and it contains two lists. There are 2 buttons. Each button opens one view of the list, and the other will collapse. But the listview will not adjust the width to fit within the group package.
How can I create a list in a group box?
Remove the dock before adding the control.
ie On the button, click clear panel using dockPanel.Children.Clear (); and add a new item using dockPanel.Children.Add (control);
Make the width of the ListView as "Auto" and HorizontalAligment = "Strech" ... hope this solves your problem.