How to move panels between tabs?

Jul 16, 2013 at 7:55 PM
Folks I went through the code and I must have missed it. I assumed you can move panels between tabs using a combination of RibbonItemCollection and SetOwner methods but the SetOwner<*> methods are internal to the library and short of implementing my own changes I'm wondering if there is another way of doing this that I have overlooked.

For example. I have a panel with MDI window options (Close, Tile Vertically, Tile, Horizontally, Cascade, etc) Rather then have several of these I want these to be moved and available to the current tab active for the current MDIChild window.

Thanks in advance.
Jul 17, 2013 at 4:39 PM
Yepp. You are right. You need to define this several times. I know that limitation but do not know the reasons for it. This still code from menendezpoo.
Jul 23, 2013 at 9:37 PM
The following few lines of code add the unique functionality that I was looking for. Perhaps someone else might make use of it.

I needed to have certain panels move, actually more appropriately float, between tabs. For example, I made a "Windows Panel" that contained a close button, vertical align button, horizontal align button, etc. and I want to make that panel available on any current active tab.

RibbonPanel.cs: add the following code
        [Description("Allows this Panel to float to the Active Tab")]
        public bool AlwaysAvailable
            get { return _alwaysAvailable; }
            set { _alwaysAvailable = value; }
Ribbon.cs: Modify the following
// Add: 
using System.Linq;

// Modify the ActiveTab Property
        public RibbonTab ActiveTab
            get { return _activeTab; }
                // Add: Collection to hold floating panels
                List<RibbonPanel> floaters = new List<RibbonPanel>(); 

                RibbonTab NewTab = _activeTab;
                foreach (RibbonTab tab in Tabs)
                    if (tab != value)
                        NewTab = tab;
                    // Add: Remember any Panel from every tab that has 'AlwaysAvailable' set to true 
                    floaters.AddRange(tab.Panels.Where(p => p.AlwaysAvailable));

                // Add: Removes floater panels from their current tab
                if (floaters.Count > 0 && _activeTab != null)
                    floaters.ForEach(p => _activeTab.Panels.Remove(p));

                _activeTab = value;

                // Add: Insert the floater panels into the newly active tab 
                floaters.ForEach(p =>
                    if (!_activeTab.Panels.Contains(p))