Hello,
my problem is that the custom command I bound to the MenuTool surrounding a GalleryTool isn't executed. The CommandBindings are set correctly, because the same thing with an MenuTool containing Buttons works quite fine.
galleryMenu.Command = ChangeSkinCommand;galleryMenu.ShouldDisplayGalleryPreview = true;galleryMenu.ButtonType = MenuToolButtonType.Segmented;
Then I bound to the selectedItem ... to retrieve the correct command parameter:
Binding selectionBinding = new Binding("SelectedItem.Key");selectionBinding.Source = gallery;galleryMenu.SetBinding(MenuTool.CommandParameterProperty, selectionBinding);
This all works fine. The menu has the correct value as command parameter, but still it's not executed. What did I wrong?
Stef
The gallery preview items within the header of the menu tool have no relation to the menu tool's command so they would not be firing the command. You may want to submit a suggestion for adding ICommandSource support to the GalleryItem(Presenter) so a gallery item could be associated with a command. For now, you would need to handle the ItemClicked of the GalleryTool and execute the command via code.
Here's another vote for adding ICommandSource support for GalleryItem. Also, please add Text and Tooltips (example: Styles gallery in Word2010)
Hello Ramajayam,
Here you can find a sample showing how to use Interactions to add command to the GalleryTool:
http://ko.infragistics.com/community/forums/p/79890/402942.aspx
Can you please share a source code, instead of generically explaining in Text?
I want to have GallaryTool with each item binded to the command and each item should have a CommandParameter. Parameter is important. This will be helpful for me.
Thank you
I think it is possible to use the System.Windows.Interactivity.InvokeCommandAction to solve this problem. If you are using the StateButton mode for the Gallery, you just have this set EventName to ItemSelected, and then use a {Binding ...} to the SelectedItem to set up the Command or CommandParameter. This will just about work out-of-the-box, and you can do it all in XAML.
If you want to make it work with ItemClicked, there is a little more work involved; you'll need to write an attached property that stores the last item clicked.