This is a migrated thread and some comments may be shown as answers.

Label in Ribbon Bar

5 Answers 112 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Ching-Yen
Top achievements
Rank 1
Ching-Yen asked on 17 Mar 2008, 08:05 AM
Hi,

I need to add a combobox to the ribbon bar, and a label next to it @ the same time. But, I only manage to add ComboBox but not the label. May I know how?

Thanks.

5 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 18 Mar 2008, 09:53 AM
Hello Ching-Yen,

Thank you for writing.

You can add RadComboBox followed by RadLabel into a Chunk of RadRibbonBar using the code-block below as reference:

RadComboBoxElement radComboElement = new RadComboBoxElement();  
radComboElement.MinSize = new Size(100, 20);  
 
RadLabelElement radLabelElement = new RadLabelElement();  
radLabelElement.MinSize = new Size(100, 20);  
radLabelElement.Text = "new label";  
 
RadRibbonBarButtonGroup ribbonGroup = new RadRibbonBarButtonGroup();  
ribbonGroup.Items.Add(radComboElement);  
ribbonGroup.Items.Add(radLabelElement);  
 
this.radRibbonBarChunk1.Items.Add(ribbonGroup); 

You could also read the following KB Article that describes how to add a WinForms control to a RadRibbonBar

I hope this helps. Please contact me again if you need a further assistance.

Kind regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ching-Yen
Top achievements
Rank 1
answered on 20 Mar 2008, 03:20 AM
Hi,

thanks for the reply. But, I am trying to create it by using the IDE, and not the code (means i would like to preview it during design time). And I couldn't find any "labelElement", please advice.
0
Martin Vasilev
Telerik team
answered on 20 Mar 2008, 02:34 PM
Hi Ching-Yen,

Unfortunately at the moment we do not support adding RadLabel to a RadRibbonBar in design time. We plan to address this feature in our upcoming release Q1 2008.

If you have any other questions, please don't hesitate to write me again.

Greetings,
Martin Vasilev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
DenisCL
Top achievements
Rank 1
answered on 13 Apr 2011, 03:35 PM
Hello,

i'm trying to add in a ribbonbargroup a Label and a dateTimePicker.
But it's not working at all.

Can you please tell me what's wrong in my code? :

            RadLabel label = new RadLabel();
            label.Text = "test";

            DateTimePicker datePicker = new DateTimePicker();
            datePicker.Size = new Size(100, datePicker.Height);

            RadPanel panel = new RadPanel();
            panel.Size = new Size(100, 60);
            panel.Controls.AddRange(new Control[] { label, datePicker });

            RadHostItem hostItem = new RadHostItem(panel);

            this.rbgPeriode.Items.Add(hostItem);  // is a radRibbonBarGroup added manually in the designer of ribbonbar

If I only add a datetimepicker  directly with panel, it's working:

            DateTimePicker datePicker = new DateTimePicker();
            datePicker.Size = new Size(100, datePicker.Height);
            RadHostItem datePickerHost = new RadHostItem(datePicker);
            this.rbgPeriode.Items.Add(datePickerHost );

Thanks for your help
0
Martin Vasilev
Telerik team
answered on 18 Apr 2011, 02:56 PM
Hello DenisCL,

Thank you for writing.

To provide enough space to your custom panel, you have set the MinSize property of the RadHostItem.
This setting will increase the size of the ribbon bar group and as a result you will be able to see its content. Please consider the following code snippet:
RadLabel label = new RadLabel();
label.Location = new Point(5, 5);
label.Text = "test";
DateTimePicker datePicker = new DateTimePicker();
datePicker.Location = new Point(32, 5);
datePicker.Size = new Size(100, datePicker.Height);
RadPanel panel = new RadPanel();
panel.Controls.AddRange(new Control[] { label, datePicker });
RadHostItem hostItem = new RadHostItem(panel);
hostItem.MinSize = new Size(140, 0);
this.radRibbonBarGroup1.Items.Add(hostItem);

I hope this helps. Let me know if you have any additional questions.

Greetings,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
RibbonBar
Asked by
Ching-Yen
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Ching-Yen
Top achievements
Rank 1
DenisCL
Top achievements
Rank 1
Share this question
or