views:

155

answers:

2

I have a GroupBox inside it a DockPanel and it contain two listviews. There are 2 buttons, On each button click one listview will visible and other will collapse. But the listview will not adjust the width to make it fit inside the groupbox.

How can I make the listview fit inside the groupbox?

A: 

Make ListView width as "Auto" and HorizontalAligment = "Strech"... hope this solves your problem

Prashant
Its not working.
Sauron
At end of the button click event, call UpdateLayout method of GroupBox or DockPanel
Prashant
A: 

Clear the dockpanel before add the control.

i.e On button click clear the panel using dockPanel.Children.Clear(); and add new item using dockPanel.Children.Add( control );

Sauron