Hi,
I have Parent and child forms:
private void ultraToolbarsManager1_ToolClick(object sender, ToolClickEventArgs e) { switch (e.Tool.Key) { case "Position": { FPosition p = new FPosition(); ultraToolbarsManager1.Ribbon.Tabs[0].Groups[1].Visible = true; p.MdiParent = this; p.Show(); ///////// Child Form break; }
}
I want to hide again the Groups[1]:
ultraToolbarsManager1.Ribbon.Tabs[0].Groups[1].Visible = false;
after closing the child form.
Hello Ettbessi,
What I could suggest you in this case is to use anonymous handling of closing event of the child form, in order to keep your code in parent from and have easy access to the parent UltraToolbarsManager. So you could use code like following in ToolClik event:
switch (e.Tool.Key) { case "ShowChild": // ButtonTool // Place code here ChildForm form = new ChildForm(); ultraToolbarsManager1.Ribbon.Tabs[0].Groups[1].Visible = true; form.MdiParent = this; form.FormClosing += delegate(object childSender, FormClosingEventArgs arg) { int cfCount = this.MdiChildren.Count(f => f is ChildForm) ; // check if there is any opened instance of type ChildForm, before hide the group if (cfCount < 2) ultraToolbarsManager1.Ribbon.Tabs[0].Groups[1].Visible = false; }; form.Show(); break;
Please let me know if you have any further questions
Thank you.
I got an error about this.MdiChildren.Count
I added : using System.Linq; and it fine now.
Thank you
Hello,
As far as I understand you were able to solve your issue.
Please let me know if you have any further questions regarding this matter.