I'm attempting a grouped ComboBox using GroupStyle:
<ComboBox ItemsSource="{Binding GroupedItems}">
<ComboBox.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ComboBox.GroupStyle>
</ComboBox>
Here the "GroupedItems" property is a ListCollectionView with a "GroupDescription" applied.
This almost works: the headers are correct, but the items themselves do not appear in the popup. Why?
Note: I'm using the a modified version of the ComboBox styles/templates on MSDN.
It turns out that the
ComboBoxcontrol template on MSDN is wrong, and the documentation is also wrong. I realized this after I removed the styles/templates from my resources, and then the grouping showed up correctly.After extracting the actual built-in control template using Blend, I found that the grouping functionality of the
ComboBoxrelies on these named parts: "Popup" (not "PART_Popup" as is listed on MSDN), "DropDown", "DropDownBorder", "DropDownScrollViewer", and "ItemsPresenter".Thanks
Obama!Microsoft!