Hi,
We're using Prism as a framework for our Silverlight application. In addition, we have the Infragistics XamWebRibbon in the top region.
Our problem is in using Prism commanding in conjunction with the XamWebRibbon to bind click events in the XamWebRibbon to a delegate method in our ModelView.
http://development-guides.silverbaylabs.org/Video/Prism-Commands#videolocation_2
Out of the box, Prism only contains Button click Commands. We are trying to write a Command that will handle the Infragistic XamWebRibbon click events. We have written the classes to handle the RibbonClick, CommandBehaviour and CommandBehaviourBase. CommandBehaviourBase has been tried with types ButtonTool, RibbonTool and RibbonToolControl. Unfortunately without success. In each case we're getting unhelpful parser errors in our XAML on Initialize which we declare the command binding.
Has anybody got Infragistics events / Prism Commanding working ? Can you share the CommandBehaviour/CommandBehaviourBase classes ?
Thanks,
Did you manage to resolve your problem? Have you tried it against the Silverlight 4 runtime? It seems to provide better detail on Xaml parse errors than previous versions, so it may help diagnose the problem with the Xaml. Barring that, the best strategy is usually (unfortunately) to comment out portions of the Xaml until you find the offending statement.
Is there any sample code you can provide that demonstrates the problem?
-Graham
Thanks for the reply Graham,
Unfortunately I didn't manage to resolve the prism issue on that project. I've since moved on to another project so I guess that's the end of the issue for me. Thanks anyway,
We also have this issue...there doesn't seem to be any way to get bindings to work properly with the ribbon tools. The only way binding is working is if you bind to a StaticResource...so to bind to your ViewModel, you have to register it as a resource in the ResourceDictionary of your view;For example; public MainPage(){ ViewModel vm = new ViewModel { MyCaption = "Tool text" }; this.Resources.Add("MyViewModel", vm); InitializeComponent(); this.DataContext = vm; }
And then you can bind to the MyCaption and any commands in XAML by refering to the view model added to the resource dictionary of your user control.<ig:XamWebRibbon> <ig:XamWebRibbon.Tabs> <ig:XamWebRibbonTabItem Header="Tab1"> <ig:XamWebRibbonGroup Caption="Group 1"> <ig:ButtonTool x:Name="buttonToolGr1" Caption="{Binding Path=MyCaption, Source={StaticResource MyViewModel}}" local:RibbonBehaviors.ButtonToolClickCommand="{Binding Path=TheCommand, Source={StaticResource MyViewModel}}"> </ig:ButtonTool> </ig:XamWebRibbonGroup> </ig:XamWebRibbonTabItem> </ig:XamWebRibbon.Tabs> </ig:XamWebRibbon>
I hope someone from Infragistics can comment on this...is this really the only way to get bindings to work with the ribbon tools? The way it is now, it's just a hack.Also, you'd think that binding to the data context of the Ribbon or a grid (or some object that inherits from FramworkElement and thus have a DataContext) should work, but that does not work either, for some reason. {Binding Path=DataContext.MyCaption, ElementName=LayoutRoot}