I have a XamRibbon acting as a main application toolbar with button 'Save'. I am loading various UserControls into the main viewing area, each has a ViewModel behind it - acting as views.
1.How do you wire up XamRibbon ButtonTool to a ViewModel command in general?
2. Each of my user controls/views would like to wireup its SaveCommand RelayCommand to the main toolbar 'Save' button when is loaded. How would I accomplish something like that?
I am using NA 2010.2 at the moment and MVVM Light. Sample is appreciated. Thanks.
Hello Andre,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Recommendations at your link are not any good for a XamRibbon users - buttons should activate/deactivate based on CanExecute ICommand method and the suggestions are using Pub/Sub methodologies. Either way, I got my question resolved following RoutedCommand MVVM implementation suggested here: http://codingcontext.wordpress.com/2008/12/10/commandbindings-in-mvvm/
Thanks for your help.
I can suggest you see this link:
http://stackoverflow.com/questions/14564244/how-to-route-a-button-command-from-a-view-to-numerous-viewmodels
where it is discussed how to route a command from View to numerous ViewModels. Since this is not related to Infragistics controls, if you need further assistance on this matter I can suggest you ask your question in the MS forums, because there you can get an answer from an expert in that area.
Hope this helps you.
Stefan, I've seen all posts that you have listed and neither pertains to my problem. First of all, my project is WPF (as opposed to SL) and XamRibbon ButtonTool (unlike SL version) works with ICommand just fine. Therefore, if I wanted to just execute the RelayCommand declared in MainWindowVM there is no problem. However, in my case, I want a XamRibbon button to 'route' the click notification to a 'child' user control ViewModel, not the MainWindowVM. What is the best way to get this done? Thanks.
Thank you for your post. I have been looking into it and I can suggest you see this blogs and forum thread:
http://es.infragistics.com/community/blogs/devin_rader/archive/2011/07/12/extending-a-xamribbon-buttontool-to-execute-icommands.aspx
and
http://es.infragistics.com/community/blogs/ivo_evtimov/archive/2011/07/26/using-xamribbon-buttontool-in-mvvm-applications.aspx
http://es.infragistics.com/community/forums/t/73050.aspx
where it is discussed how to use Commands in ButtonTool.