Search Results

Search found 200 results on 8 pages for 'contextmenu'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Windows Explorer Context Menu Integration, get file that was right clicked on

    - by racxen
    I've already figured out how to add a menu item to the right click context menu of the windows explorer using the registry. I currently have it set to launch my application when my menu item is clicked. However, I want to know if there is a way to know what file is was right clicked on. I thought it would have been sent as a command line argument to the launched program, but it's not. Any ideas?

    Read the article

  • How do I add items to the Finder context menu in Mac OS X?

    - by mystro
    I'm in the process of porting a Windows application to OS X (we wrote it in Java so most of the code is portable), but what I'm currently unsure of is how to add context menu items in the Finder window when the user right clicks on an item (i.e. I wish to add some items to the the menu that has "Open" "Open with" , "Get Info", etc... when the user right clicks). Most of the articles I've found deal specifically with Windows (I've searched for "context menus" and "shell extension", but I believe I may be searching the wrong terms), so I'm curious as to how to go about adding this in Mac or what literature I should be reading.

    Read the article

  • How can i create a context menu in c# in a datagridview

    - by lanoxx
    Hi all, I have written a datagridview with a couple of columns to store data of a product, now i want to be able to right click any row and have a context menu appear with the options delete and copy. Copy should have the same functionality as if I press Ctrl+C. Any help would be appreciated. Im using C# and WinForms. I have never done context menus before, so I would be thank full for any hint or link to further readings. Cheers

    Read the article

  • Show menu when view is long pressed

    - by swift1691
    I've been looking around on the internet regarding my question but I couldn't find a straight answer. Is it possible to create a non-blocking menu similar to the overflow menu found in Android 4.0+ when a view is long pressed? I have a number of LinearLayout instances which have an OnLongClickListener which brings up a context menu, but it's not exactly what I am looking for. I was hoping for a smoother menu which is brought up when one of these instances is clicked, and removed when the user clicks outside of the menu's region. This is very similar to the way the overflow menu behaves in the Android ActionBar. So to sum up, is it possible to replicate the look-and-fell and the behavior of the overflow menu when using context menus? Here's hoping I don't have to jump through hoops to get the implementation that I desire. Thanks in advance. EDIT: After some digging I've found the PopupMenu which is exactly what I was looking for however it works only on devices running Honeycomb and above. Does anyone know of a way with which I can replicate this menu behavior in older versions of Android without using blocking windows like dialogs?

    Read the article

  • Double right click to Show a PopUpMenu with A TListView !!

    - by djiga4me
    Hi, I have a TListView and TPopupMenu, and I want to show a context menu when I right click on a TListItem. I tried the "AutoPopup" by assigning the component, but on a right click the PopupMenu is shown only and the wanted element is not selected. So i tried to use the "OnMouseDown", but we need to click and click again to show the menu on the wanted item. The first click is to select the item and the second shows the menu. But I want just a one click to do the two things. Do you have and idea about the problem? Thank you.

    Read the article

  • javascript context menu in iframe

    - by alex
    Hi, I have a problem with JQuery Context Menu ( link text ) and iframe. If i use it inside, the context menu is naturaly shown inside. But it will be partialy shown. I am searching how to resolve it. Please note that the context menu only appear when i click on specific iframe's elements. thanks :)

    Read the article

  • How do you hidden/show particular context menu item in flex?

    - by R.Vijayakumar
    var contextMenu:ContextMenu = new ContextMenu(); contextMenu.hideBuiltInItems(); var contactList : ContextMenuItem = new ContextMenuItem("Add to Existing List"); contactList.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doStaticListCommand); var newContactList : ContextMenuItem = new ContextMenuItem("Add a New List"); newContactList.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doNewStaticListCommand); var removeContactList : ContextMenuItem = new ContextMenuItem("Remove contact from List"); removeContactList.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doRemoveListCommand); var deletecontact:ContextMenuItem = new ContextMenuItem("Delete contact"); deletecontact.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, dodeleteconactCommand); var TimeList : ContextMenuItem = new ContextMenuItem("Add Time Spent"); TimeList.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doTimeListCommand); contextMenu.customItems.push(contactList); contextMenu.customItems.push(newContactList); contextMenu.customItems.push(deletecontact); contextMenu.customItems.push(removeContactList); In flex i done contex menu , if i rigt click then show context menu item but i want to hidden particular context menu item in list , is it possiable hidden and show particular items in context menu ? please refer me

    Read the article

  • WinForms Taskbar Icon - Click Event not firing

    - by Greycrow
    I have created a non-form c# program that uses the NotifyIcon class. The text "(Click to Activate)" shows up when I hover the mouse. So I am getting some events handled. However, The "Click" event does not fire and the Context menu doesnt show up. public class CTNotify { static NotifyIcon CTicon = new NotifyIcon(); static ContextMenu contextMenu = new ContextMenu(); static void Main() { //Add a notify Icon CTicon.Icon = new Icon("CTicon.ico"); CTicon.Text = "(Click to Activate)"; CTicon.Visible = true; CTicon.Click += new System.EventHandler(CTicon_Click); //Create a context menu for the notify icon contextMenu.MenuItems.Add("E&xit"); //Attach context menu to icon CTicon.ContextMenu = contextMenu; while (true) //Infinite Loop { Thread.Sleep(300); //wait } } private static void CTicon_Click(object sender, System.EventArgs e) { MessageBox.Show("Clicked!"); } }

    Read the article

  • Problem with multiple event handling in JQuery

    - by Greg
    Hi everyone, I have a strange jquery problem with multiple event handlers. What I'm trying to achieve is this: User selects some text on the page If the selection is not empty - show a context menu If user clicks somewhere else - the context menu should disappear I'm having troubles with the above i.e. sometimes the context menu appears correctly, sometimes it appears and disappears straight after user makes a selection. Please help. See the relevant parts of my code below. Also when user selects a paragraph or a word by double clicking - context menu appears and quickly disappears again. var ContextMenu = { ... show: function(e) { var z = this; if (!this.shown) { if (this.contextMenu) { this.contextMenu.css({ left: e.pageX, top: e.pageY }).slideDown('fast'); this.shown = true; } var hideHandler = function() { z.hide(this); }; $(document.body).bind("click", hideHandler); } }, hide: function(hideHandler) { if (this.contextMenu && this.shown) { this.contextMenu.slideUp('fast'); this.shown = false; $(document.body).unbind("click", hideHandler); } } }; // Context menu display logic $(document.body).bind("mousedown mouseup", function(e) { if ((window.getSelection().toString() != "") && (!ContextMenu.shown)) { ContextMenu.show(e); } });

    Read the article

  • Mouse position in xaml - wpf

    - by Simon Fox
    Hi all Is it possible to specify the position of the mouse as the value of the Parameter property of a Command in XAML. Something like the following: <UserControl.ContextMenu> <ContextMenu> <MenuItem Header="Create Link" Command="{Binding CreateLink}" CommandParameter="{Binding Mouse.Position}" > </MenuItem> </ContextMenu> </UserControl.ContextMenu>

    Read the article

  • XAML Parsing Exception

    - by e28Makaveli
    I have a simple XAML page that load fine when it is loaded as part of any application within Visual Studio. However, when I deploy this application using ClickOnce, I get the following exception: Type : System.Windows.Markup.XamlParseException, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Message : Unable to cast object of type 'System.Windows.Controls.Grid' to type 'EMS.Controls.Dictionary.StatusBarControl'. Error at object 'System.Windows.Controls.Grid' in markup file 'EMS.Controls.Dictionary;component/views/statusbarcontrol.xaml'. Source : PresentationFramework Help link : LineNumber : 0 LinePosition : 0 KeyContext : UidContext : NameContext : BaseUri : pack://application:,,,/EMS.Controls.Dictionary;component/views/statusbarcontrol.xaml Data : System.Collections.ListDictionaryInternal TargetSite : Void ThrowException(System.String, System.Exception, Int32, Int32, System.Uri, System.Windows.Markup.XamlObjectIds, System.Windows.Markup.XamlObjectIds, System.Type) Stack Trace : at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType) at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException) at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord) at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment() at System.Windows.Markup.TreeBuilder.Parse() at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at EMS.Controls.Dictionary.StatusBarControl.InitializeComponent() at EMS.Controls.Dictionary.StatusBarControl..ctor(IDataView content) at OCC600.ReportManager.ReportPresenter.ShowQueryView(Object arg, Boolean bringForward, Type selectedDataType) at OCC600.ReportManager.ReportPresenter..ctor(IUnityContainer container) at OCC600.ReportManager.Module.Initialize() at Microsoft.Practices.Composite.Modularity.ModuleLoader.Initialize(ModuleInfo[] moduleInfos) Inner Exception --------------- Type : System.InvalidCastException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Unable to cast object of type 'System.Windows.Controls.Grid' to type 'EMS.Controls.Dictionary.StatusBarControl'. Source : EMS.Controls.Dictionary Help link : Data : System.Collections.ListDictionaryInternal TargetSite : Void System.Windows.Markup.IComponentConnector.Connect(Int32, System.Object) Stack Trace : at EMS.Controls.Dictionary.StatusBarControl.System.Windows.Markup.IComponentConnector.Connect(Int32 connectionId, Object target) at System.Windows.Markup.BamlRecordReader.ReadConnectionId(BamlConnectionIdRecord bamlConnectionIdRecord) at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) The XAML page is given below: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cdic="clr-namespace:EMS.Controls.Dictionary.Primitives" xmlns:dicutil="clr-namespace:OCC600.Infrastructure.Dictionary.Utility;assembly=EMS.Infrastructure.Dictionary" Loaded="ResultSetControl_Loaded" <StatusBarItem Margin="10,0, 10, 0"> <TextBlock Text="{Binding CountText}" Padding="5,0"/> </StatusBarItem> <StatusBarItem Margin="10,0"> <TextBlock Text="{Binding MemoryUsageText}" Padding="5,0"/> </StatusBarItem> <StatusBarItem Margin="10,0" MaxWidth="400"> <TextBlock Text="{Binding StatusReport.Summary}" Padding="5,0" /> </StatusBarItem> <ProgressBar Margin="20,0" Name="progBar" Width="150" Height="13" Visibility="Collapsed" > <ProgressBar.ContextMenu> <ContextMenu Name="ctxMenu" ItemsSource="{Binding ActiveWorkItems}" Visibility="{Binding Path=ActiveWorkItems.HasItems, Converter={StaticResource BooToVisConv}}"> <ContextMenu.ItemContainerStyle> <Style TargetType="{x:Type MenuItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type MenuItem}"> <StackPanel Height="20" Margin="10,0" Orientation="Horizontal" HorizontalAlignment="Left"> <TextBlock Text="{Binding Path=Name, Mode=OneTime}" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Left" /> <ToggleButton Style="{StaticResource vistaGoldenToggleButtonStyle}" Padding="5,0" Content="Cancel" IsChecked="{Binding Cancel}" Margin="10,0,0,0" > </ToggleButton> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> </ContextMenu.ItemContainerStyle> </ContextMenu> </ProgressBar.ContextMenu> </ProgressBar> <StatusBarItem Margin="10,0" MaxWidth="400" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Last Update:" Padding="5,0" /> <TextBlock Text="{Binding TimeStamp}" Padding="5,0" /> </StackPanel> </StatusBarItem> <!-- TODO: Put checkmark if all is well, or error if connection failed--> <StatusBarItem Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=dc:Ribbon, ResourceId=StatusBarItemAlt}}" DockPanel.Dock="Right" Padding="6,0,32,0" > <cdic:SplitButton Margin="5,0" Padding="5,2" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type cdic:SplitButtonResources}, ResourceId=vistaSplitButtonStyle}}" Mode="Split"> <cdic:SplitButton.ContextMenu> <ContextMenu > <MenuItem Header="Refresh Now" Command="{Binding ToggleConnectivityCmd}" CommandParameter="false"/> <MenuItem IsCheckable="True" IsChecked="{Binding ConnectState, Converter={StaticResource isFailedConverter}}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=IsChecked}" Header="Work Offline" Command="{Binding ToggleConnectivityCmd}"/> </ContextMenu> </cdic:SplitButton.ContextMenu> <cdic:SplitButton.Content> <StackPanel Orientation="Horizontal"> <Image x:Name="img" Source="{Binding ConnectState, Converter={StaticResource imageConverter}}" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center"/> <TextBlock Text="{Binding ConnectState}" Padding="3,0,0,0"/> </StackPanel> </cdic:SplitButton.Content> </cdic:SplitButton> </StatusBarItem> </StatusBar> </Grid> The error just seems to have come out of no where. Any ideas? TIA.

    Read the article

  • Delete image file used by XAML

    - by Frode Lillerud
    I'm trying to delete a Image file in WPF, but WPF locks the file. <Image Source="C:\person.gif" x:Name="PersonImage"> <Image.ContextMenu> <ContextMenu> <MenuItem Header="Delete..." x:Name="DeletePersonImageMenuItem" Click="DeletePersonImageMenuItem_Click"/> </ContextMenu> </Image.ContextMenu> </Image> And the Click handler just looks like this: private void DeletePersonImageMenuItem_Click(object sender, RoutedEventArgs e) { System.IO.File.Delete(@"C:\person.gif"); } But, when I try to delete the file it is locked and cannot be removed. Any tips on how to delete the file?

    Read the article

  • Bind Command to MenuItem

    - by Neir0
    Hi I have ListView and i am trying to bind command to ContextMenu of ListView. <ListView x:Name="listView1" ItemsSource="{Binding Path=Persons}"> <ListView.Resources> <ContextMenu x:Key="ItemContextMenu"> <MenuItem Header="Add" /> <MenuItem Header="Edit"/> <Separator/> <MenuItem Header="Delete" Command="{Binding Msg}" /> </ContextMenu> </ListView.Resources> <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <!--<EventSetter Event="PreviewMouseLeftButtonDown" />--><!--Handler="OnListViewItem_PreviewMouseLeftButtonDown" />--> <Setter Property="ContextMenu" Value="{StaticResource ItemContextMenu}"/> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> </Style> </ListView.ItemContainerStyle> <ListView.View> <GridView> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}" /> <GridViewColumn Header="Sur Name" DisplayMemberBinding="{Binding Path=SurName}" /> <GridViewColumn Header="Age" DisplayMemberBinding="{Binding Path=Age}" /> </GridView> </ListView.View> </ListView> <Button Content="Message" Command="{Binding Msg}" /> Binding to Button works well but when i click to delete item in ContextMenu, command is not working! Why?

    Read the article

  • Dynamic context menus for a BlackBerry CLDC Application

    - by Jacob Tabak
    In my custom field in a BlackBerry CLDC Application, I want to display a specific context menu based on the current state of the field. My original idea was to do something like this: protected void makeContextMenu(ContextMenu contextMenu) { if (isPaused()) contextMenu.addItem(resumeMenuItem); else contextMenu.addItem(pauseMenuItem); } However, the state of the field doesn't seem to be affecting the items on the context menu. I'm assuming that the context menu only gets "made" once during the life of the field. Is there a way to do what I'm trying to do?

    Read the article

  • How to create a dynamically built Context Menu clickEvent

    - by Chris
    C#, winform I have a DataGridView and a context menu that opens when you right click a specific column. What shows up in the context menu is dependant on what's in the field clicked on - paths to multiple files (the paths are manipulated to create a full UNC path to the correct file). The only problem is that I can't get the click working. I did not drag and drop the context menu from the toolbar, I created it programmically. I figured that if I can get the path (let's call it ContextMenuChosen) to show up in MessageBox.Show(ContextMenuChosen); I could set the same to System.Diagnostics.Process.Start(ContextMenuChosen); The Mydgv_MouseUp event below actually works to the point where I can get it to fire off MessageBox.Show("foo!"); when something in the context menu is selected but that's where it ends. I left in a bunch of comments below showing what I've tried when it one of the paths are clicked. Some result in empty strings, others error (Object not set to an instance...). I searched code all day yesterday but couldn't find another way to hook up a dynamically built Context Menu clickEvent. Code and comments: ContextMenu m = new ContextMenu(); // SHOW THE RIGHT CLICK MENU private void Mydgv_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { int currentMouseOverCol = Mydgv.HitTest(e.X, e.Y).ColumnIndex; int currentMouseOverRow = Mydgv.HitTest(e.X, e.Y).RowIndex; if (currentMouseOverRow >= 0 && currentMouseOverCol == 6) { string[] paths = myPaths.Split(';'); foreach (string path in paths) { string UNCPath = "\\\\1.1.1.1\\c$\\MyPath\\"; string FilePath = path.Replace("c:\\MyPath\\", @""); m.MenuItems.Add(new MenuItem(UNCPath + FilePath)); } } m.Show(Mydgv, new Point(e.X, e.Y)); } } // SELECTING SOMETHING IN THE RIGHT CLICK MENU private void Mydgv_MouseUp(object sender, MouseEventArgs e) { DataGridView.HitTestInfo hitTestInfo; if (e.Button == MouseButtons.Right) { hitTestInfo = Mydgv.HitTest(e.X, e.Y); // If column is first column if (hitTestInfo.Type == DataGridViewHitTestType.Cell && hitTestInfo.ColumnIndex == 6) { //MessageBox.Show(m.ToString()); ////MessageBox.Show(m.Tag.ToString()); //MessageBox.Show(m.Name.ToString()); //MessageBox.Show(m.MenuItems.ToString()); ////MessageBox.Show(m.MdiListItem.ToString()); // MessageBox.Show(m.Name); //if (m.MenuItems.Count > 0) //MessageBox.Show(m.MdiListItem.Text); //MessageBox.Show(m.ToString()); //MessageBox.Show(m.MenuItems.ToString()); //Mydgv.ContextMenu.Show(m.Name.ToString()); //MessageBox.Show(ContextMenu.ToString()); //MessageBox.Show(ContextMenu.MenuItems.ToString()); //MenuItem.text //MessageBox.Show(this.ContextMenu.MenuItems.ToString()); } m.MenuItems.Clear(); } } I'm very close to completing this so any help would be much appreciated. Thanks, ~ Chris

    Read the article

  • Binding one dependency property to another

    - by Gregory Dodd
    I have a custom Tab Control that I have created, but I am having an issue. I have an Editable TextBox as part of the custom TabControl View. <Controls:EditableTextControl x:Name="PageTypeName" Style="{StaticResource ResourceKey={x:Type Controls:EditableTextControl}}" Grid.Row="0" TabIndex="0" Uid="0" AutomationProperties.AutomationId="PageTypeNameTextBox" AutomationProperties.Name="PageTypeName" Visibility="{Binding ElementName=PageTabControl,Path=ShowPageType}"> <Controls:EditableTextControl.ContextMenu> <ContextMenu x:Name="TabContextMenu"> <MenuItem Header="Rename Page Type" Command="{Binding Path=PlacementTarget.EnterEditMode, RelativeSource={RelativeSource AncestorType=ContextMenu}}" AutomationProperties.AutomationId="RenamePageTypeMenuItem" AutomationProperties.Name="RenamePageType"/> <MenuItem Header="Delete Page Type" Command="{Binding Path=PageTypeDeletedCommand}" AutomationProperties.AutomationId="DeletePageTypeMenuItem" AutomationProperties.Name="DeletePageType"/> </ContextMenu> </Controls:EditableTextControl.ContextMenu> <Controls:EditableTextControl.Content> <!--<Binding Path="CurrentPageTypeViewModel.Name" Mode="TwoWay"/>--> <Binding ElementName="PageTabControl" Path="CurrentPageTypeName" Mode ="TwoWay"/> </Controls:EditableTextControl.Content> </Controls:EditableTextControl> In the Content section I am binding to a Dependency Prop called CurrentPageTypeName. This Depedency prop is part of this custom Tab Control. public static DependencyProperty CurrentPageTypeNameProperty = DependencyProperty.Register("CurrentPageTypeName", typeof(object), typeof(TabControlView)); public object CurrentPageTypeName { get { return GetValue(CurrentPageTypeNameProperty) as object; } set { SetValue(CurrentPageTypeNameProperty, value); } } In another view, where I am using the custom TabControl I then bind my property, with the actual name value, to CurrentPageTypeName property as seen below: <Views:TabControlView Grid.Row="0" Name="RunPageTabControl" TabItemsSource="{Binding RunPageTypeViewModels}" SelectedTab="{Binding Converter={StaticResource debugConverter}}" CurrentPageTypeName="{Binding Path=RunPageName, Mode=TwoWay}" TabContentTemplateSelector="{StaticResource tabItemTemplateSelector}" SelectedIndex="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.SelectedTabIndex}" ShowPageType="Hidden" > <!--<Views:TabControlView.TabContentTemplate> <DataTemplate DataType="{x:Type ViewModels:RunPageTypeViewModel}"> <RunViews:RunPageTypeView/> </DataTemplate> </Views:TabControlView.TabContentTemplate>--> </Views:TabControlView> My problem is that nothing seems to be happening. It is grabbing its Content from the Itemsource, and not from my chained Dependency props. Is what I am trying even possible? If so, what have I done wrong. Thanks for looking.

    Read the article

  • Searching for context in Silverlight applications

    - by PeterTweed
    A common behavior in business applications that have developed through the ages is for a user to be able to get information or execute commands in relation to some information/function displayed by right clicking the object in question and popping up a context menu that offers relevant options to choose. The Silverlight Toolkit April 2010 release introduced the context menu object.  This can be added to other UI objects and display options for the user to choose.  The menu items can be enabled or disabled as per your application logic and icons can be added to the menu items to add visual effect.  This post will walk you through how to use the context menu object from the Silverlight Toolkit. Steps: 1. Create a new Silverlight 4 application 2. Copy the following namespace definition to the user control object of the MainPage.xaml file: xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"   3. Copy the following XAML into the LayoutRoot grid in MainPage.xaml:          <Border CornerRadius="15" Background="Blue" Width="400" Height="100">             <TextBlock Foreground="White" FontSize="20" Text="Context Menu In This Border...." HorizontalAlignment="Center" VerticalAlignment="Center" >             </TextBlock>             <my:ContextMenuService.ContextMenu>                 <my:ContextMenu >                     <my:MenuItem                 Header="Copy"                 Click="CopyMenuItem_Click" Name="copyMenuItem">                         <my:MenuItem.Icon>                             <Image Source="copy-icon-small.png"/>                         </my:MenuItem.Icon>                     </my:MenuItem>                     <my:Separator/>                     <my:MenuItem Name="pasteMenuItem"                 Header="Paste"                 Click="PasteMenuItem_Click">                         <my:MenuItem.Icon>                             <Image Source="paste-icon-small.png"/>                         </my:MenuItem.Icon>                     </my:MenuItem>                 </my:ContextMenu>             </my:ContextMenuService.ContextMenu>         </Border>   The above code associates a context menu with two menu items and a separator between them to the border object.  The menu items has icons associated with them to add visual appeal.  The menu items have click event handlers that will be added in the MainPage.xaml.cs code behind in a later step. 4. Add two icon sized images to the ClientBin directory of the web project hosting the Silverlight application, named copy-icon-small.png and paste-icon-small.jpg respectively.  I used copy and paste icons as the names suggest. 5. Add the following code to the class in MainPage.xaml.cs file:         private void CopyMenuItem_Click(object sender, RoutedEventArgs e)         {             MessageBox.Show("Copy selected");         }           private void PasteMenuItem_Click(object sender, RoutedEventArgs e)         {             MessageBox.Show("Paste selected");         }   This code adds the event handlers for the menu items defined in step 3. 6. Run the application, right click on the border and select a menu option and see the appropriate message box displayed. Congratulations it’s that easy!   Take the Slalom Challenge at www.slalomchallenge.com!

    Read the article

  • WPF MenuItem IsChecked Binding not working

    - by Kaya
    Anyone know why the menu item binding does not work ? <ToggleButton Name="toggleButton" Checked="checkBoxPublish_Checked" > <ToggleButton.Resources> <converters:BooleanToHiddenVisibility x:Key="boolToVis"/> </ToggleButton.Resources> <Grid> <Image Height="auto" HorizontalAlignment="Left" Margin="5" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="auto" /> <Viewbox > <TextBlock Text="Blocked" Opacity="0.7" Foreground="Red" Visibility="{Binding Path=IsChecked, ElementName=toggleButton, Converter={StaticResource boolToVis}}"/> </Viewbox> </Grid> <ToggleButton.ContextMenu> <ContextMenu StaysOpen="True" > <MenuItem x:Name="menuItemBlock" Header="Block" Click="menuItemClick" IsCheckable="True" IsChecked="{Binding ElementName=toggleButton, Path=IsChecked}"/> <MenuItem x:Name="menuItemIgnorePtz" Header="Ignore Ptz" Click="menuItemClick" IsCheckable="True" /> </ContextMenu> </ToggleButton.ContextMenu> </ToggleButton>

    Read the article

  • WPF TreeViewItem Context Menu Unhighlights Item

    - by Snea
    I have been having problems with this for some time now, and have come up with some less-than-desirable solutions. The problem is that when a TreeViewItem's context menu is opened, the TreeViewItem is greyed out. Is it possible for a TreeViewItem to stay highlighted while its ContextMenu is open? The problem with the TreeViewItem greying out, is that it gives no relation to the context menu and the TreeViewItem, and it looks ugly. Generally, the code I use for setting a context menu is this. Sometimes the context menu will be generated by the code with a PreviewRightMouseButtonDown EventSetter, but it doesn't make a difference. <TreeView> <TreeView.Resources> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu> <MenuItem Header="Menu Item 1" /> <MenuItem Header="Menu Item 2" /> </ContextMenu> </Setter.Value> </Setter> </Style> </TreeView.Resources> <TreeViewItem Header="Item 1"> <TreeViewItem Header="Sub-Item 1"/> </TreeViewItem> <TreeViewItem Header="Item 2"></TreeViewItem> </TreeView> So far the only solution I have found is to override the "grey" unfocused color with the focused color, but then the TreeView never seems unfocused, such as when another control is clicked on. I have had problems with ListViews as well.

    Read the article

  • Trouble binding WPF Menu to ItemsSource

    - by chaiguy
    I would like to avoid having to build a menu manually in XAML or code, by binding to a list of ICommand-derived objects. However, I'm experiencing a bit of a problem where the resulting menu has two levels of menu-items (i.e. each MenuItem is contained in a MenuItem): My guess is that this is happening because WPF is automatically generating a MenuItem for my binding, but the "viewer" I'm using actually already is a MenuItem (it's derived from MenuItem): <ContextMenu x:Name="selectionContextMenu" ItemsSource="{Binding Source={x:Static OrangeNote:Note.MultiCommands}}" ItemContainerStyleSelector="{StaticResource separatorStyleSelector}"> <ContextMenu.ItemTemplate> <DataTemplate> <Viewers:NoteCommandMenuItemViewer CommandParameter="{Binding Source={x:Static OrangeNote:App.Screen}, Path=SelectedNotes}" /> </DataTemplate> </ContextMenu.ItemTemplate> </ContextMenu> (The ItemContainerStyleSelector is from http://bea.stollnitz.com/blog/?p=23, which allows me to have Separator elements inside my bound source.) So, the menu is bound to a collection of ICommands, and each item's CommandParameter is set to the same global target (which happens to be a collection, but that's not important). My question is, is there any way I can bind this such that WPF doesn't automatically wrap each item in a MenuItem?

    Read the article

  • Android: How to find the position clicked from the context menu

    - by Josemalive
    Hi, I have a list view filled with data. I set up a context menu for the listview using the following code: list.setOnCreateContextMenuListener ( new View.OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { AdapterContextMenuInfo mi =(AdapterContextMenuInfo) menuInfo; menu.add(0, 0, 0, "Delete item"); } } ); I have the following method override to control de contextmenu menuitem selected: @Override public boolean onContextItemSelected(MenuItem item) { switch(item.getItemId()) { case 0: ShowAlert("hello from delete item"); break; default: return super.onContextItemSelected(item); } return true; } In this overrided method, how could i find the item of the list view that was clicked? Thanks in advance. Best Regards. Jose

    Read the article

  • Flex 3: Possible to add a Context Menu to a ItemRenderer inside a DataGrid?

    - by gmoniey
    I have an ItemRenderer that is shared by several applications (inside a DataGrid), and I would like to add a context menu to it (rather than in each application). The renderer is derived from the Canvas class, and the code to create the context menu looks something like: var menuItem:ContextMenuItem = new ContextMenuItem("Test"); menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextCallback); var customContextMenu:ContextMenu = new ContextMenu(); customContextMenu.hideBuiltInItems(); //hide flash menu customContextMenu.customItems.push(menuItem); this.contextMenu = customContextMenu; However, when I right click on the cell in the datagrid, I get the default Flash Context Menu. Is this not possible?

    Read the article

  • How can I make a Jeditable (jQuery) span activate editing on more than one event?

    - by JonathanHayward
    For the jQuery extension Jeditable, one of the parameters that can be specified is which DOM event will turn a div/span/... into a text input/textarea/... I would like to have more than one event serve as a trigger; that is, I would like either a click event or a contextmenu event to turn a span into an in-place edit area. Is there a graceful way to do this without forking Jeditable? --edit-- An example of code specifying the event is below. The parameter is optional, defaulting to a regular click. $(".edit_rightclick").editable("/ajax/save", { cancel: "Cancel", submit: "OK", tooltip: "Right click to edit.", event: "contextmenu", }); Calling twice, once for the regular click event with the event unspecified, and one for the contextmenu event (right-click if there are no switched mouse buttons or anything like that) does not seem to produce the intended effect of an element becoming editable in place on a click from either mouse button.

    Read the article

  • Context Menu SourceControl Error

    - by developer
    Hi All, I am trying to use contextmenu in my textbox control and I want to bind the textbox value to the value selected in context menu,below is my code <Window.CommandBindings> <CommandBinding Command="local:MyPanel.ChangeTextboxValue" Executed="ChangeTextboxValue_Executed"/> </Window.CommandBindings> CODE-BEHIND public static RoutedUICommand ChangeTextboxValue = new RoutedUICommand ("ChangeTextboxValue", "ChangeTextboxValue", typeof(MyPanel)); private void ChangeTextboxValue_Executed(object sender, ExecutedRoutedEventArgs e) { string oldvalue = Convert.ToString(e.Parameter); (((sender as MenuItem).Parent as ContextMenu).PlacementTarget as TextBox).Text = oldvalue; } oldvalue is the value I want the textbox controls value to change to. I am trying to use above code but it gives me the error, 'Object reference not set to an instance of object'. I tried to debug the app and I get ContextMenu as null.. .Any ideas why??

    Read the article

  • Jquery li element id

    - by Gazler
    Hi, I am using a jquery contextmenu plugin for right click menus which I am trying to add to each li element of an unordered list with the ID mailbox. The code I have is: $("#mailbox > li").contextMenu('myMenu1', { bindings: { 'open': function(t) { alert('Trigger was '+t.id+'\nAction was Open'); } //CODE SNIPPED }); My assumption is that this should alert the id of the list element that the contextMenu was called from, however it is returning an empty string. Am I accessing/assigning these correctly? t is an object HTMLLIElement in the context above by the way. Cheers, Gazler.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >