private void CtxmPullUpSubMenu(MenuItem menu, bool?isEndDot = null) { if (menu.Items.Count == 1) { var submenu = (menu.Items[0] as MenuItem); menu.ToolTip = submenu.ToolTip ?? (submenu.Header is FrameworkElement ? (submenu.Header as FrameworkElement).Tag : MenuUtil.DeleteAccessKey(submenu.Header as string, true)); menu.Command = submenu.Command; (menu.CommandParameter as EpgCmdParam).Data = (submenu.CommandParameter as EpgCmdParam).Data; (menu.CommandParameter as EpgCmdParam).ID = (submenu.CommandParameter as EpgCmdParam).ID; menu.Items.Clear(); } if (isEndDot != null) { CtxmPullUpSubMenuSwitchEndDot(menu, (bool)isEndDot); } }