private void MyToolWindow_MouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { OleMenuCommandService commandService = PBMCommand.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; CommandID menuID = new CommandID(typeof(PBMCommand.ContextMenuCommandSet).GUID, (int)PBMCommand.ContextMenuCommandSet.idContextMenu); Point p = this.PointToScreen(e.GetPosition(this)); commandService?.ShowContextMenu(menuID, (int)p.X, (int)p.Y); }
private void FunctionListWindow_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { if (null != _commandService) { CommandID menuID = new CommandID(AbstractFunctionListCommand.CommandSet, Constants.FunctionListMenu); Point p = PointToScreen(e.GetPosition(this)); _commandService.ShowContextMenu(menuID, (int)p.X, (int)p.Y); } }
/// <summary> /// Handles the MouseRightButtonDown event of the Grid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseButtonEventArgs"/> instance containing the event data.</param> private void Grid_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { OleMenuCommandService mcs = this._parent.mcs; if (null != mcs) { CommandID menuID = new CommandID(GuidList.GuidOpenCoverTestExplorerContextMenuCommandSet, PkgCmdIDList.CommandIDOpenCoverTestExplorerContextMenu); Point p = this.PointToScreen(e.GetPosition(this)); mcs.ShowContextMenu(menuID, (int)p.X, (int)p.Y); } }
//<snippet43> private void MyToolWindow_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { OleMenuCommandService mcs = this._parent.mcs; if (null != mcs) { CommandID menuID = new CommandID( GuidList.guidTWShortcutMenuCmdSet, PkgCmdIDList.ColorMenu); Point p = this.PointToScreen(e.GetPosition(this)); mcs.ShowContextMenu(menuID, (int)p.X, (int)p.Y); } }