Hi
The Ribbon control looks really good. It can save me a lot of time building a menu.
I am aware that it is still in the CTP version, can you provide a tentative time period of when this would be a full release.
Most importantly, are you planning to implement the Commanding feature for all the ribbon tools? My application uses MVVM and the workaround that needs to be put into place is time consuming.
Thanks.
Nrupal
HI Nrupal,
The Ribbon actually released earlier this week, in our 10.1 Release.
And all tools support our Commanding framework via their Commands property
Hope this helps,
-SteveZ
Hi Steve
Thank you for the quick reply.
Aah, I do see the Commanding implemented in the RibbonTool base class. But for some strange reason visual studio doesn't recognise Command and breaks on it.
"The property 'Command' was not found in type 'ButtonTool'."
Am I missing any other reference or should I be using a XML namespace mapping?
PS: I am currently using the trial version. Sure that this shouldn't have anything to do with the problem.
Thank you.
Hi Georgi
Thanks for the sample. I'm sure it will help others in the future.
You're quite correct. I let VS implement the interface and I never even looked at the code, I just changed the returns.
Kr
Robin
The sample fails if you change the ribbon to minimized.
<ig:XamWebRibbon x:Name="_Ribbon" IsMinimized="True">
The command never gets actioned.
Hi Robin,
You're right, it's not working with minimized Ribbon. I guess that's because when the Ribbon is minimized the ButtonTool is placed inside a Popup, which actually breaks the Visual Tree and the UserControl is not checked if it's a valid CommandTarget. We'll have to take a deeper look into that.
A better approach here would be to make the Ribbon a Command Target for your command.
Just create a new class that derives from XamWebRibbon and override SupportsCommand method, returning true for your custom commands. Attached is the modified sample that shows this.
@Brian: I didn't try Prism Commanding capabilities, I'll do so as soon as possible.
Hope that helps,
Thanks for the quick response and solution.
re: the Prism Commanding - I'll be interested to see what you make of this. I'm using Prism in both my SL and WPF apps and the commanding is simple and effective to use.
George
lordrob said: Hi Georgi Thanks for the quick response and solution. re: the Prism Commanding - I'll be interested to see what you make of this. I'm using Prism in both my SL and WPF apps and the commanding is simple and effective to use. Kr George
I gave it a quick try - attached is a sample of what I was able to do. Basically, two issues came up:
Issue #1 is that Ribbon's tools are not derived from Control, so you'll have to create your own CommandBehaviorBase<T> class and derive your commands from it.
Issue #2 is that Ribbon's tools are not derived from FrameworkElement so they do not support binding. So you can't just bind your attached properties (commands) in XAML. In the attached sample I set the command on the ButtonTool in code-behind, which is kinda against MVVM rules.
This second issue should be resolved with SL4 which introduces the ability to bind properties on DependencyObjects and not just on FrameworkElements.
I am able to bind Prism commands directly from the Ribbon control. I'm using 10.1 version.
<
}" />
.UndoButtonEnablement}" />
Even though we are using MVVM, the commands go in the xaml.cs and call methods in the ViewModel. In the case above however we are raising a Prism aggregate event which all modules subscribe to. I'll just show one of the command implemenations below.
#region
Save Command
DelegateCommand<bool> _SaveCommand;
public DelegateCommand<bool> SaveCommand
{
get
if (_SaveCommand == null)
_SaveCommand =
new DelegateCommand<bool>(Save, CanSave);
return _SaveCommand;
}
public bool CanSave(bool param)
return CommonContext.objRibbonInstance.SaveButtonEnablement;
public void Save(bool param)
//get the active view
string strActiveView = GetActiveRegionName();
if (strActiveView.Length > 0)
//send the save event using the view tag as the payload
mobjEventAggregator.GetEvent<
SaveViewDataRequestEvent>().Publish(strActiveView);
#endregion
// Save Command