How to: Merge Ribbon Controls

  • 2 minutes to read

This example demonstrates the merging mechanism for RibbonControls in action. The main and child MDI forms contain RibbonControls. The child form's RibbonControl is merged into the main form's RibbonControl when the child form is maximized.

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++;
}