Another way to do it that would require more fiddling around with the xaml though, would be to modify the Expander control template. In the control template on MSDN, you can see that the grid row that's named ContentRow
. The height of that row starts at 0, then a trigger on the IsExpanded
property expands it to its desired height. If you set the default ContentRow
height to something like 50 (or whatever height is needed to show the number of items you want), it will show the top part of the group's items when the Expander is collapsed.
You can read up more on how to modify ControlTemplates here.