contextmenu

WPF Submenu for context menu

随声附和 提交于 2019-12-03 13:03:58
问题 If the Context menu is "hardcoded" in xaml, then it is easy to add submenus. For example: <ContextMenu> <MenuItem Header="Comm1" Command="{Binding Blabla1}"> <MenuItem Header="SubComm1" Command="{Binding Blabla2}"></MenuItem> </MenuItem> <MenuItem Command="Comm2"></MenuItem> <MenuItem Command="Comm3"></MenuItem> </ContextMenu> This means, that the ContextMenu has three elements (Comm1, Comm2 and Comm3) and Comm1 has submenu SubComm1. I have made my ContextMenu a bit more flexible:

C# - DatagridView and ContextMenu

寵の児 提交于 2019-12-03 12:40:20
I have a datagridview where I show infomation about products. I want to bind a contextmenu when the user selects a cell and then right clicks on that cell. I have another contextmenu and that one is bound to the columns of the datagridview. If a user right clicks on a column the contextmenu shows. I have tried like this but it does not work. The context menu shows when the user right clicks on a cell, but the contextmenu that is bound to the column header does not work. private void GridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) {

“Build” item in Windows Explorer's context menu of a VS solution file?

给你一囗甜甜゛ 提交于 2019-12-03 12:29:00
I wonder why this is not integrated by default. I'd like to have an item in Windows Explorer's file context menu of a VS solution file to build it. Is there a tool for this? Or do I have to create this myself? MSBuild Shell Extension have been there for years, http://msbuildshellex.codeplex.com/ But you might also try out my new project, http://msbuildlaunchpad.codeplex.com/releases/view/45368 It is quite easy to use. MSBuild Launch Pad http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=msbuildlaunchpad&DownloadId=122261 It's going to be fairly high maintenance, but not

Context Menu for XAML Treeviewitem (Distinguished by different attributes)

我是研究僧i 提交于 2019-12-03 10:57:14
问题 In XAML, how do you define a context menu for treeviewitems that are distinguished by different attributes? 回答1: XAML <TreeView Name="SolutionTree" BorderThickness="0" SelectedItemChanged="SolutionTree_SelectedItemChanged" > <TreeView.Resources> <ContextMenu x:Key ="SolutionContext" StaysOpen="true"> <MenuItem Header="Add..." Click="AddFilesToFolder_Click"/> <MenuItem Header="Rename"/> </ContextMenu> <ContextMenu x:Key="FolderContext" StaysOpen="true"> <MenuItem Header="Add..." Click=

How can I add a context menu to a ListBoxItem?

狂风中的少年 提交于 2019-12-03 10:39:29
问题 I have a ListBox and I want to add a context menu to each item in the list. I've seen the "solution" to have the right click select an item and suppress the context menu if on white space, but this solution feels dirty. Does anyone know a better way? 回答1: This way the menu will pop up next to the mouse private string _selectedMenuItem; private readonly ContextMenuStrip collectionRoundMenuStrip; public Form1() { var toolStripMenuItem1 = new ToolStripMenuItem {Text = "Copy CR Name"};

menu inflating calls multiple times at fragment's onCreateOptionsMenu

倾然丶 夕夏残阳落幕 提交于 2019-12-03 10:36:51
I use Fragments and when I switch to nested Fragment, which implements public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) my menu inflates quantity of times when I get to that nested Fragment. How can I avoid this? I also implement constructor of Fragment with methods: setRetainInstance(true); setHasOptionsMenu(true); When I tried to implement siple solution as: @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // TODO Add your menu entries here if(!isInflated) { inflater.inflate(R.menu.contacts_archive_menu, menu); isInflated = true; } super

How can I get right-click context menus for clicks in QTableView header?

我只是一个虾纸丫 提交于 2019-12-03 09:53:54
问题 The sample code below (heavily influenced from here) has a right-click context menu that will appear as the user clicks the cells in the table. Is it possible to have a different right-click context menu for right-clicks in the header of the table? If so, how can I change the code to incorporate this? import re import operator import os import sys from PyQt4.QtCore import * from PyQt4.QtGui import * def main(): app = QApplication(sys.argv) w = MyWindow() w.show() sys.exit(app.exec_()) class

How i can create context menu for extjs grid

六月ゝ 毕业季﹏ 提交于 2019-12-03 09:32:24
问题 I can create context menu for tree and attach to 'contextmenu' event. Code: contextMenu = new Ext.menu.Menu({ items: [{ text: 'Edit', iconCls: 'edit', handler: edit },...] }) Ext.getCmp('tree-panel').on('contextmenu', function(node) { contextMenu.show(node.ui.getAnchor()); }) But how I can create context menu for grid elements? 回答1: First define your context menu mnuContext = new Ext.menu.Menu({ items: [{ id: 'do-something', text: 'Do something' }], listeners: { itemclick: function(item) {

Determining which ListViewItem was clicked on in a ListView when executing a ContextMenu MenuItem

余生长醉 提交于 2019-12-03 09:31:45
I'm trying to use the context menu in a listview to run some code that requires data from which item it originated from. I initially just did this: XAML: <ListView x:Name="lvResources" ScrollViewer.VerticalScrollBarVisibility="Visible"> <ListView.Resources> <ContextMenu x:Key="resourceContextMenu"> <MenuItem Header="Get Metadata" Name="cmMetadata" Click="cmMetadata_Click" /> </ContextMenu> </ListView.Resources> <ListView.ItemContainerStyle> <Style TargetType="{x:Type ListViewItem}"> <Setter Property="ContextMenu" Value="{StaticResource resourceContextMenu}" /> </Style> </ListView

How to create jqGrid Context Menu?

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to create a context menu on jqGrid (for each row) but can't find how to do so.I am currently using jQuery Context Menu (is there a better way? )but it is for the entire Grid not for a particular row i.e. cannot perform row level operations for it. Please help me in this, thanks. $(document).ready(function(){ $("#list1").jqGrid({ sortable: true, datatype: "local", height: 250, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:60, sorttype:"int"}, {name:'invdate',index: