Dynamic MenuItems in ContextMenu in ListView

I have a ListView with a List of Computers. For each Computer i want to see a Context Menu on RightClick.

That works so far by:

<ListView x:Name="lvComputers" HorizontalAlignment="Left" Height="450" Margin="10,28,0,0" VerticalAlignment="Top" Width="536"> <ListView.View> <GridView> <GridViewColumn DisplayMemberBinding="{Binding computerName}" Header="Computername" Width="100" /> <GridViewColumn DisplayMemberBinding="{Binding operatingSystem}" Header="Betriebssystem." Width="auto" /> </GridView> </ListView.View> <ListView.Resources> <ContextMenu x:Key="ItemContextMenu"> </ContextMenu> </ListView.Resources> <ListView.ItemContainerStyle> <Style TargetType="{x:Type ListViewItem}" > <Setter Property="ContextMenu" Value="{StaticResource ItemContextMenu}" /> </Style> </ListView.ItemContainerStyle> </ListView>

The Problem is, i want the Menu Items to be dynamic depends on what computer was clicked. how do i achieve that?

Category:c# Views:16 Time:2018-12-18

Related post

  • Dynamic Menuitem and ActionExpression 2012-01-23

    My code is like: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http

  • Dynamically have a ContextMenu for every ListViewItem in a ListView? 2011-01-12

    I am currently having a ContextMenu on a ListView with its view style set to "GridView". However, this gives me trouble because you are able to right-click the visual columns in the top of the ListView to get the context-menu to appear as well. I onl

  • WPF contextmenu and ListView 2010-02-12

    Ok, hopefully this is simple but for some reason I can't find a straight answer and I'm not familiar enough with WPF yet to know how to do it. I have a listview, it gets bound to an observable collection of objects to display. I want to have a contex

  • Contextmenu on listview datatemplate not working 2012-03-04

    I have a simple ListView bound to a collection of Calculations. The view calls the calc Name property in the display. I have set the contextmenu to the individual items in the listview but on right click the context menu shows up as a tiny box with n

  • Delayed ContextMenu on ListView 2013-02-18

    I have an Activity with a ListView. You long-press each row to get a ContextMenu. At the bottom of the ListView is an EditText box. It looks like this: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:

  • ElementName Binding from MenuItem in ContextMenu 2009-06-18

    Has anybody else noticed that Bindings with ElementName do not resolve correctly for MenuItem objects that are contained within ContextMenu objects? Check out this sample: <Window x:Class="EmptyWPF.Window1" xmlns="http://schemas.microsoft.com/winf

  • Dynamically adding combobox in DataList / Listview 2009-07-20

    I have a web page where I have to let the user dynamically add /remove comboboxes. I have a page I did a year ago where I used a datalist control to hold all the controls. Is a listview control any better? or is there a better approach? -------------

  • WPF : Suppress ContextMenu for ListView 2009-08-11

    I have a WPF ListView control with a ContextMenu written in XAML Code. With every right-click on the ListView the ContextMenu is shown even when there are no items in the ListView. This is a behavior I don't want. The ContextMenu should only open if

  • FF extension: a popup with dynamic menuitems, with each menu item having another popup 2010-05-06

    I am building an extension that has a popup whose elements are constructed by a function call everytime the mouse hovers over the popup option. I am able to achieve this. Now I need to have a popup for each of the menu item (inside the original popup

  • Dynamically add elements to a listView Android 2010-12-27

    Can anyone explain or suggest a tutorial to create a listView in android? Here are my requirements: I should be able to dynamically add new elements by pressing a button. Should be simple enough to understand (possibly without any performance improve

  • ContextMenu onItemClick (ListView) 2011-02-06

    I need a context menu to be shown when user clicks on item in listview (not long tap). How it can be implemented? --------------Solutions------------- Easiest way it probably to do it like Reflog said. But you could try it like this: enable long clic

  • Dynamically setting imageview in a listview item is slow 2011-03-02

    I'm having trouble with my listviews items. I'm dynamically getting some images from a XML file, downloading the image and setting it. I'm trying to primitively cache the bitmap fetched to speed up the getView process of my listviews adapter. But whe

  • dynamically adding images to a ListView 2011-04-26

    I know this question sound familiar and you will tell me that I should find my answer if made a little search on it... but pls nothing is working for me! I need a code that can add dynamically a specific image to each row content! super.onCreate(save

  • android how to dynamically bind checkboxes with custom listview 2011-05-06

    I create checkboxes dynamically & i want to bind that checkboxes to listview. How can I do that? Here i give my code-- public class HomeActivity extends ListActivity{ CheckBox[] chk; ListView lv1; public void onCreate(Bundle savedInstanceState) {

  • EventHandlers of dynamic controls created in a ListView are not fired, if the ListView is bound in Page_Load 2011-06-10

    In our intranet ASP .NET application we use an architecture approach which is similar to the MVVM pattern. Our viewmodel, which describes the state of the view, is either created or loaded in Page_Load from the ViewState. Depending on the viewmodel c

  • How to add CSS for dynamic MenuItems in MenuList and How to get the value of the MenuItem in XUL 2011-08-13

    I want to create menuList as displayed in the picture. https://developer.mozilla.org/En/XUL:menuitem#Examples When I checked in the Firefox website, it shows "Note: The menuitem must have a class of menuitem-iconic for the image to appear. " In my ca

  • How to access the textbox of dynamically created table inside the listview of the usercontrol page? 2012-02-28

    Actually I'm developing web template using asp.net and c#. I have maintemp.aspx page which includes usercontrol page. In my usercontrol I have a listview which in this listview I have to create dynamic table inside the ItemTemplate based on a XML fil

  • Dynamic event handler for the ListView? 2009-03-14

    It must be my special luck that today I stack with another problem and for second time coming here for help. And I really need help on this one. I have a listView control on which i have a button control. I am trying to add event handler to this butt

  • Not every dynamic MenuItem is processed, why? 2010-09-06

    On a masterpage I have ASP Menu control. It looks like this: <asp:Menu ID="mnuMainMenu" runat="server" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="Medium" ForeColor="#7C6F57" Orientation="Horizontal" StaticSubMenuIndent="10px" Font

  • Styling added dynamic list items to a listview with AJAX 2011-09-19

    I've been buried in jQuery Mobile code and documentation for a while now, but I just can't seem to figure this out. I have a listview in my jQM site. It's nothing very complicated, but I want to add items to the list as the user scrolls down. I have

  • How to add elements dynamically using jQuery (mobile) as listview 2011-10-10

    I'm trying to get jQuery (mobile) to add new <li> elements to a <ul> which has data-role set to "listview" Here's the html: <div data-role="page"> <header data-role="header"> <h1>Header</h1> </header> <div

  • dynamic number of columns in listview 2012-01-20

    I want to create a layout like this (Like Windows Tiles). The number of columns will be 1 or 2. Which layout I can use in android? I used ListView but in this I can't get two clickable columns. Please help. --------------Solutions------------- http:/

  • Set notification from resource by contextmenu on listview 2012-04-04

    i have two strings array: String[] name ={ “Sound 1″, “Soundname 2″, “Chainsaw!”}; int[] sounds = {R.raw.sound1, R.raw.sound2, R.raw.chainsaw}; and a listview: list.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterVie

  • Determining which ListViewItem was clicked on in a ListView when executing a ContextMenu MenuItem 2009-07-14

    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"> <Lis

  • create fixed size thumbnail dynamically on listview control 2009-10-06

    how to create fixed size thumbnail dynamically and resize image in listview best fit the size of the thumbnail. private void Treeview1_AfterSelect(System.Object sender, System.Windows.Forms.TreeViewEventArgs e) { if (folder != null && System.

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.089 (s). 11 q(s)