Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
[Ribbon] [Tabs][Group] Hiding
posted

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.

Parents
  • 48586
    posted

    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

Reply Children