public override void OnApplyTemplate()
{
if (Level == RibbonApplicationMenuItemLevel.Top)
{
RibbonHelper.UnhookPopupForTopLevelMenuItem(this);
}
base.OnApplyTemplate();
if (Level == RibbonApplicationMenuItemLevel.Top)
{
// Bind properties such as PlacementTarget, Height and
// Width for the submenu Popup to the parent
// RibbonApplicationMenu's SubmenuPlaceholder element.
RibbonHelper.HookPopupForTopLevelMenuItem(this, ParentItemsControl);
}
}