private void OnTabChange(object sender, TabSelectionChangeEventArgs e)
 {
     if (((e.CurrentItem.Identifier == 1) || (e.CurrentItem.Identifier == 2)) || (e.CurrentItem.Identifier == 3))
     {
         Rectangle selectedTabBounds = e.SelectedTabBounds;
         CommandID menuID = null;
         if (e.CurrentItem.Identifier == 1)
         {
             menuID = WorkflowMenuCommands.PageLayoutMenu;
         }
         else if (e.CurrentItem.Identifier == 2)
         {
             menuID = WorkflowMenuCommands.ZoomMenu;
         }
         else
         {
             menuID = WorkflowMenuCommands.PanMenu;
         }
         IMenuCommandService service = (IMenuCommandService) this.GetService(typeof(IMenuCommandService));
         if (service != null)
         {
             service.ShowContextMenu(menuID, selectedTabBounds.Right, selectedTabBounds.Top);
         }
     }
 }
        private void OnTabChange(object sender, TabSelectionChangeEventArgs e)
        {
            if (e.CurrentItem.Identifier == (int)TabButtonIds.MultiPage ||
                    e.CurrentItem.Identifier == (int)TabButtonIds.Zoom ||
                    e.CurrentItem.Identifier == (int)TabButtonIds.Pan)
            {
                Rectangle buttonRect = e.SelectedTabBounds;
                CommandID menuID = null;

                if (e.CurrentItem.Identifier == (int)TabButtonIds.MultiPage)
                    menuID = WorkflowMenuCommands.PageLayoutMenu;
                else if (e.CurrentItem.Identifier == (int)TabButtonIds.Zoom)
                    menuID = WorkflowMenuCommands.ZoomMenu;
                else
                    menuID = WorkflowMenuCommands.PanMenu;

                IMenuCommandService menuCommandService = (IMenuCommandService)GetService(typeof(IMenuCommandService));
                if (menuCommandService != null)
                    menuCommandService.ShowContextMenu(menuID, buttonRect.Right, buttonRect.Top);
            }
        }