Expanders inside listbox leaving blank space on collapse?

Have you tried using DockPanel as your root's ListBox s ItemsPanel and have each Expander s DockPanel. Dock="Top?

Have you tried using DockPanel as your root's ListBox's ItemsPanel, and have each Expander's DockPanel. Dock="Top"?

I had a similar problem with a ListView, and this solution worked perfectly. – user20489 Sep 29 '10 at 18:57.

I have a ListBox that contains a set of DataItems. The DataTemplate for each item is an Expander. The header is text, the content of the Expander is a ListBox.

The ListBox contains SubDataItems. The DataTemplate for each SubDataItem is an Expander. There is a problem with how the layout is produced.

If any Expander corresponding to the SubDataItem is expanded, the ListBoxItem containing this ListBox (the Expander. Content in the parent DataTemplate) correctly requests more space. So I can expand all SubDataItems and correctly see my data.

However, when I collapse, the space I previously asked to expand, remains blank, instead of being reclaimed by the ListBoxItem. This is a problem because if I have say 10 SubDataItems and happen to expand all of them at the same time and then collapse, there is a significant amount of white space wasting my real estate. How can I force WPF to resize the ListBoxItem to the correct state?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions