New to Telerik UI for WinForms? Start a free 30-day trial
Adding a WinForms control to a Ribbon Bar
Updated over 6 months ago
| Product Version | Product | Author | Last modified |
|---|---|---|---|
| Q2 2007 | RadRibbonBar for WinForms | Iordan Pavlov | May 23, 2007 |
HOW-TO
Adding a WinForms control to a Ribbon Bar
SOLUTION
Any Windows Forms control can be added to a Ribbon Bar. That can be done easily by using RadHostItem.
For example a Windows Forms DateTimePicker can be added to a Ribbon Bar with the following piece of code:
C#
DateTimePicker datePicker = new DateTimePicker();
RadHostItem datePickerHost = new RadHostItem(datePicker);
this.RadRibbonBarGroup1.Items.Add(datePickerHost);
Another example is adding a WinForms panel with radio buttons:
C#
RadioButton radioButton1 = new RadioButton();
radioButton1.Text = "Option1";
radioButton1.Location = new Point(5, 5);
RadioButton radioButton2 = new RadioButton();
radioButton2.Text = "Option2";
radioButton2.Location = new Point(5, 25);
Panel panel = new Panel();
panel.Size = new Size(100, 60);
panel.Controls.AddRange(new Control[] { radioButton1, radioButton2 });
RadHostItem hostItem = new RadHostItem(panel);
this.radRibbonBarGroup1.Items.Add(hostItem);