How to Pass MULTIPLE filenames to a Context Menu Shell Command?

You can use Send To for this. It supports multiple files. In case this website goes offline: Open shell:sendto with Windows + R or paste it into your explorer address bar. It should redirect you to: C:\Users\<yourusername>\AppData\Roaming\Microsoft\Windows\SendTo Create a shortcut to your program in this folder and you should see it in your explorer right-click … Read more

How to configure ContextMenu buttons for delete and disabled in SwiftUI?

All of the asked situations are now supported in iOS 15 Destructive: (works from iOS 15) Set .destructive as the role argument of the button: Button(role: .destructive) { // 👈 This argument // delete something } label: { Label(“Delete”, systemImage: “trash”) } Disabled: (works from iOS 14.2) Add .disabled modifier to the button. Button { … Read more

How to retrieve the element where a contextmenu has been executed

You can inject content script with contextmenu event listener and store element that was clicked: manifest.json “content_scripts”: [{ “matches”: [“<all_urls>”], “js”: [“content.js”], “all_frames”: true, “match_about_blank”: true }] content script.js //content script var clickedEl = null; document.addEventListener(“contextmenu”, function(event){ clickedEl = event.target; }, true); chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { if(request == “getClickedEl”) { sendResponse({value: clickedEl.value}); } }); background.js … Read more

WPF – how to hide menu item if command’s CanExecute is false?

Thanks for the solution. For those wanting explicit XAML this might help: <Window.Resources> <BooleanToVisibilityConverter x:Key=”booleanToVisibilityConverter” /> </Window.Resources> <ContextMenu x:Key=”innerResultsContextMenu”> <MenuItem Header=”Open” Command=”{x:Static local:Commands.AccountOpened}” CommandParameter=”{Binding Path=PlacementTarget.DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}}” CommandTarget=”{Binding Path=PlacementTarget, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}}” Visibility=”{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource booleanToVisibilityConverter}}” /> </ContextMenu> In my case, the context menu is a resource, so the … Read more

Add menu item to Windows context menu only for specific filetype

Identify the file type (ProgID) for .jpg files This can be done by checking the default value of HKEY_CLASSES_ROOT\.jpg. It could be anything based on what you’ve installed, but for the purposes of this example, we’ll call it jpegfile, a common default. Set the context menu item (verb) properties for that file type You can … Read more

Detecting which selected item (in a ListView) spawned the ContextMenu (Android)

I do exactly this. In my onCreateContextMenu(…) method, I cast the ContextMenu.ContextMenuInfo to AdapterView.AdapterContextMenuInfo. From there, you can get the targetView, which you cast again to the widget. The complete code is available in HomeActivity.java, look for the onCreateContextMenu(…) method. @Override public void onCreateContextMenu(ContextMenu contextMenu, View v, ContextMenu.ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; … Read more

Right click to select a row in a Datagridview and show a menu to delete it

I finally solved it: In Visual Studio, create a ContextMenuStrip with an item called “DeleteRow” Then at the DataGridView link the ContextMenuStrip Using the code below helped me getting it work. this.MyDataGridView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MyDataGridView_MouseDown); this.DeleteRow.Click += new System.EventHandler(this.DeleteRow_Click); Here is the cool part private void MyDataGridView_MouseDown(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) { … Read more