Adding a WinForms control to a Ribbon Bar
|
Article relates to
|
RadControls for WinForms
|
|
Created by
|
Iordan Pavlov, Telerik
|
|
Last modified
|
May 23, 2007
|
|
Last modified by
|
Iordan Pavlov, Telerik
|
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:
| DateTimePicker datePicker = new DateTimePicker(); |
| RadHostItem datePickerHost = new RadHostItem(datePicker); |
| |
| this.RadRibbonBarGroup1.Items.Add(datePickerHost); |
Another example is adding a WinForms panel with radio buttons:
| 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); |
Comments
If you'd like to comment on this KB
article, please, send us a
Support Ticket.
Thank you!
Please
Sign In
to rate this article.