Example E1917
Visible to All Users

WinForms Ribbon - MDI Ribbon merge

This example demonstrates automatic menu merging for MDI applications. The main and child MDI forms contain a Ribbon UI. The child form's RibbonControl is merged into the main form's RibbonControl when the child form is maximized.

C#
private void Form1_Load(object sender, EventArgs e) { ribbonControl1.MdiMergeStyle = RibbonMdiMergeStyle.OnlyWhenMaximized; CreateChildForm(); }

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

RibbonMerging/Form1.cs(vb)
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraBars.Ribbon; namespace RibbonMerging { public partial class Form1 : RibbonForm { public Form1() { InitializeComponent(); } #region #1 private void Form1_Load(object sender, EventArgs e) { // Enable the form's title bar transparency //this.AllowFormGlass = DevExpress.Utils.DefaultBoolean.False; // Specify that the merge mechanism should be invoked when a child MDI form is maximized. this.ribbonControl1.MdiMergeStyle = RibbonMdiMergeStyle.OnlyWhenMaximized; CreateChildForm(); } private void btnNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { CreateChildForm(); } int ctr = 1; void CreateChildForm() { // Create an MDI child form, containing a RibbonControl ReportForm child = new ReportForm(); child.Text = "Report " + ctr.ToString(); child.MdiParent = this; child.Show(); ctr++; } #endregion #1 } }
RibbonMerging/ReportForm.cs(vb)
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraBars.Ribbon; using DevExpress.XtraEditors; namespace RibbonMerging { public partial class ReportForm : XtraForm { public ReportForm() { InitializeComponent(); } } }

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.