Closed thelazycrazybrain closed 3 years ago
Some years ago i wrote a RegionAdapter for prism, that kind of did that.
A potential problem with that solution for your case will be thread identity. My code had the assumptions only one ribbon will be shown and there is just one window. The basic idea is to synchronize to insert the items of the child ribbon into the main ribbon and dont't show the child ribbon. When the child ribbon is detached, you remove the items from the main window, and display the child window.
The merging of the two ribbons did work back then, but i never tried to show the child ribbon, so there could be some difficultues.
I don't think that thread identity would be much of a problem (I think it would be safe to say, that ribbon merging across threads is simply not supported). I made a prototype earlier this day for my application that looks for a ribbon on a user control / page / whatever and removes it from its parent (content control / panel) and stores the parent reference in an attached property. After that, I can move the items / merge subitems from the source ribbon to the main (target) ribbon (and remembering the source-ribbon and the target list on the ribbon). When I detach it from the main ribbon, I just read the list of attached controls from the ribbon, match the source ribbon and remove all items from the (remembered) parent. I could also remember if the source ribbon is already merged to another ribbon, so you can't merge the same source ribbon to multiple target ribbons. I personally think it doesn't make a lot of sense to merge the same ribbon to multiple ribbons as well as showing both the source and the target ribbon at the same time (would defeat the purpose of merging).
Cheers, Jodie
@thelazycrazybrain @Pretasoc Glad you both found a working solution. I, myself, will never add such a feature to the ribbon as the requirements are way too user specific. I built something like this at work too. We don't use it to support merging different ribbons but to merge tabs/groups/controls from different view models and global providers during runtime.
Hi, Is it possible to merge two or more ribbons together? (like the DevExpress DXRibbon control). I have an MDI like application and I use a TabControl to display my views. It should be possible to add a Ribbon on that view. If I use that view in a separate window, it should display my Ribbon from the view but if I dock it in my TabControl on my main window again, it should merge with the main application ribbon. If I pop out my view into a separate window again, it should unmerge from the main ribbon and display the ribbon on my view as it was before it was merged with the main ribbon.
I haven't found a way to do that but I desperately need that feature.
Environment