Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Panels, Labels, GroupBox > RadGroupBox, add button to GroupHeader

Not answered RadGroupBox, add button to GroupHeader

Feed from this thread
  • GunGar avatar

    Posted on Oct 12, 2009 (permalink)

    I would like to add a button, maybe two, to the GroupHeader of a RadGroupBox, I've tried the following, however the button is not the correct size, it looks like it's being rendered at one pixel wide:

    public class TestGroupBox : RadGroupBox
    {
        private StackLayoutPanel  m_objStackLayoutPanel  = new StackLayoutPanel ();
        private RadButtonElement m_objButton = new RadButtonElement();

        protected override void CreateChildItems( RadElement parent )
        {
            base.CreateChildItems( parent );

            m_objStackLayoutPanel.Orientation = System.Windows.Forms.Orientation.Horizontal;

            ImageAndTextLayoutPanel panel = this.GroupBoxElement.Header.Children[2] as ImageAndTextLayoutPanel;
            this.GroupBoxElement.Header.Children.RemoveAt( 2 );
            this.GroupBoxElement.Header.Children.Add( m_objStackLayoutPanel );

            m_objStackLayoutPanel.Children.Add( m_objButton );
            m_objButton.Size = new System.Drawing.Size( 16, 16 );
            m_objStackLayoutPanel.Children.Add( panel );
        }
    }

    Reply

  • Nick Nick admin's avatar

    Posted on Oct 13, 2009 (permalink)

    Hi Scott,

    Thank you for contacting us. Well, this scenario was not really considered when RadGroupBox control was written. Nevertheless, you can try this approach:

    RadButtonElement button = new RadButtonElement();
    button.MinSize = new Size(30, 30);
    this.radGroupBox1.GroupBoxElement.Header.MinSize = new Size(70, 50);
    this.radGroupBox1.GroupBoxElement.Header.Children.Add(button);

    You can place this code in your form load event handler.

    Greetings,
    Nick
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • GunGar avatar

    Posted on Oct 13, 2009 (permalink)

    Thanks for this tip, I'll try it out.

    The reason I want a button in the GroupHeader, is that the control already allows an Image, but I need that image to be clickable, and at times add two images.

    Thanks,
    Scott

    Reply

  • Nick Nick admin's avatar

    Posted on Oct 15, 2009 (permalink)

    Hi Scott,

    I see. Do not hesitate to write back if you have more questions. 

    Best wishes,
    Nick
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Panels, Labels, GroupBox > RadGroupBox, add button to GroupHeader
Related resources for "RadGroupBox, add button to GroupHeader"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]