Pregunta

I've a RibbonControl in a mdiform and another RibbonControl added at design time in a MDIChildForm. Then in runtime, I add a RibbonPage, with a RibbonGroup and a BarButtonItem. Like this:

private void MDIChildForm_Load(object sender, EventArgs e) {
  BarButtonItem btn = ribbonControl1.Items.CreateButton("Test Button");
  RibbonPageGroup group1 = new RibbonPageGroup("Test Group");
  group1.ItemLinks.Add(btn);
  RibbonPage page1 = new RibbonPage("Test Page");
  page1.Groups.Add(group1);
  ribbonControl1.Pages.Add(page1);
}

The "Test Page" isn't visible in the MdiParent. But, when I change the active mdi child form, and the ribbon do the merge, the page appears!

It looks like the page isn't merged until I change the active mdi child form.

Am I missing something?

¿Fue útil?

Solución

I've found a solution, but I think is not the most elegant way to solve it:

mainRibbon.UnMergeRibbon();
mainRibbon.MergeRibbon(mdiChildForm.ChildRibbon);

A public property to access the child Ribbon was needed.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top