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
- Form1.cs (VB: Form1.vb)
- ReportForm.cs (VB: ReportForm.vb)
Documentation
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)
Example Code
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
}
}
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();
}
}
}