I have a XamDatatree in a UserControl and I've set a ContextMenu for some of the actions available on the main menu of the control inside the context menu.
The context menu is correctly shown but the click of the menu items does not execute the bound command.
The xammenuitems are all like the following
<ig:XamMenuItem Command="lcmd:DataMaskCommands.NewNamesList"> <ig:XamMenuItem.Header> <Label Content="{x:Static cr:NameListsEditorControlRx.mnuNewNamesList}" HorizontalContentAlignment="Left" VerticalContentAlignment="Center"/> </ig:XamMenuItem.Header> <ig:XamMenuItem.Icon> <Image Source="/Myexe;Component/Images/btn_032_109.png" /> </ig:XamMenuItem.Icon> </ig:XamMenuItem>
The command binding is the following
<CommandBinding Command="{x:Static lcmd:DataMaskCommands.NewNamesList}"
Executed="NewNamesList_Executed" CanExecute="NewNamesList_CanExecute" />
While this XamMenuItem works like a charm in the main menu of the window it does not execute the
command in the context menu. I suppose I've forgotten something fundamental in my codebut I don't know what it is, unfortunately, in the XamContextMenu samples, you use an Item clicked event handlerand there is no sample using the Command in a context menu.
if you have any clue
regards
Hello Sabrina,
Thank you for your post.
From the code that you have provided, I believe the reason your command on your XamContextMenu is not working is because you do not have the {x:Static ...} in front of it like in your CommandBinding. There also could be other things that I cannot see, such as the NewNamesList command not being instantiated in your DataMaskCommands class.
I have attached a sample application to demonstrate a command working with the XamContextMenu on a XamDataTree in a user control. I encourage you to take a look at this sample and compare it to yours to see what may be wrong.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Hi Andrew thank you for the sample, Unfortunately even doing whar you propose it does not work and I've been able to reproduce the problem on your sample project,is there a way for me to send you the project so you can take a look and see what's wrong?
Thank you in advance