public override void OnApplyTemplate()
{
ItemsControlHelper.OnApplyTemplate();
// Get the template parts
ExpanderButton = GetTemplateChild(ExpanderButtonName) as ToggleButton;
HeaderElement = GetTemplateChild(HeaderName) as FrameworkElement;
// Try to get the ExpansionStates visual state group
ExpansionStateGroup = VisualStates.TryGetVisualStateGroup(this, VisualStates.GroupExpansion);
Interaction.OnApplyTemplateBase();
base.OnApplyTemplate();
}