Ticket T206929
Visible to All Users

How to merge UserControl Ribbon with main form Ribbon when Document is docked to TabbedView and unmerge it when Document is floating

created 10 years ago

Hello!

I have main RibbonForm with DocumentManager and TabbedView. My documents control is XtraUserControl with dedicated RibbonControl. I need to implement the following: when new Document is created and docked as Tab to TabbedView, I need to merge XtraUserControl Ribbon to main form Ribbon, but when user makes Document float, I need to unmerge it, so floating Document gets its dedicated RibbonControl back. When users switch to other documents I need to repeat the same algorithms - merge ribbon if document is docked and leave it in user control if document is floating.

How I can do that?

Thank you!

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello,
To accomplish this, I suggest that you handle the TabbedView's DocumentActivated event in the following manner:

C#
void tabbedView1_DocumentActivated(object sender, DevExpress.XtraBars.Docking2010.Views.DocumentEventArgs e) { this.Ribbon.UnMergeRibbon(); int index = 0; foreach (Document document in this.tabbedView1.Documents) { if (!this.tabbedView1.Documents[index].IsFloating) { if (document.Control != null) { this.Ribbon.MergeRibbon((document.Control as UserControl1).Ribbon); } } index++; } this.Ribbon.MergeRibbon((this.tabbedView1.ActiveDocument.Control as UserControl1).Ribbon); }

Attached is the sample that demonstrates this. Please review it and let me know if this is helpful.

    Show previous comments (7)
    Sasha (DevExpress Support) 10 years ago

      You are welcome.
      Feel free to reactivate this ticket if you need further assistance.

        I tried to add RibbonStatusBar to user control, but status bar is not hiding when document is docked.

        Sasha (DevExpress Support) 10 years ago

          Hello,
          To overcome this, set the MdiMergeStyle property of the main form Ribbon to "OnlyWhenMaximized" .

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.