Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
805
Id Problems
posted

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

Parents
  • 1354
    Verified Answer
    posted

    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.

Reply Children