-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
SplitButton extents ItemsCollection, which allows me to specify a GroupStyle (useful in configurations where I want to supply a set of standard static colors and a set of theme colors).
The "PART_ListBox" needs to bind the "GroupStyle" collection in SplitButton to the ListBox.GroupStyle collection. The short term work around was to subclass the SplitButton and override the OnApplyTemplate() call.
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
// Can't use the EnforceType<ListBox> method in the base class because it's private.
ListBox listBox = GetTemplateChild("PART_ListBox") as ListBox;
if(listBox == null) { return; }
foreach(GroupStyle style in GroupStyle)
{
listBox.GroupStyle.Add(style);
}
}