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# Time:2018-12-28 Views:4

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

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

processed in 1.206 (s). 13 q(s)