First of all, you guys have done a great job with the Ribbon, I really like the style of it.
But I have some problems with using it.
When I clear the items of the Ribbon (XamWebRibbon.Tabs.Clear()) and want to readd a RibbonTab, which was previously in the collection of tabs, I'm getting an Exception like this:
Group with Id 'TabTitle1' already exists. Cannot add multiple group instances with the same Id.
It seems like that the Ribbon somehow saves the IDs of all Items, even after a Clear(), it can remember the IDs.
Second problem I have is that all the IDs must be unique in the Ribbon. Usually this make sense, but the ButtonTool has no Command or a Tag Property, so I have to save the name of a command in that Id Property to I know which command I have to execute on ButtonClick.
If I have 2 ButtonTools each in different Tabs referencing to the same command, than I get an Exception.
I'm not sure If I do something wrong or If this is an issue of the Ribbon.
Enrico
Hi Enrico,
Thanks, glad you like it :-)
The first problem you're running into sounds like a bug, I wasn't able to reproduce the exception you're seeing however so you might want to attach some sample code so I can check it out for you.
In the meantime you might be able to workaround this problem by adjusting the visibility of the tab rather than removing it and re-adding it.
Regarding the second issue, have you tried using the commands collection available off of each ribbon tool?
<ribbon:ButtonTool Caption="dbl1" SmallImage="png/7x7/dbl.png" >
<ribbon:ButtonTool.Commands>
<RibbonTest:MyCommandSource CommandType="SomeAction" EventName="Click"/>
</ribbon:ButtonTool.Commands>
</ribbon:ButtonTool>
This should allow you to add your commands to any tool in the ribbon without causing collisions. The reason we require that each ID be unique is to facilitate controls existing in multiple locations, the most prominent example being the Quick Access Toolbar. Since we can't clone a control directly we needed to be able to generate as many copies of the same tool as we needed, unique Id's on the tools allow us to do this.
If you have any other questions or concerns please let me know, I'll be happy to help.
Hi,
I haven't tried to use the CommandCollection before. I did now and it works pretty well...thanks for this suggestion.
I already tried switching the visibility of the tabs instead of removing and readding the tabs. This works fine, as long as you always want to show a tab. I have a screnario, where on one point I don't want to show any tabs. But If all tabs are collapsed, it will show the groups from the first tabs. In the XamWebRibbonPreview version was the ability to set the groups to collapsed as well, but the XamWebRibbonGroup.Visibility property is gone.
Anyway, I can live with that, my problem with the Ids was more important and this is solved.
So thanks again for your help.