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

Multiple Controls Side by Side Ribbon Bar Group

1 Answer 132 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 16 Jun 2015, 07:38 PM

Hi,

I am new telerik components and hoping someone may be able to point me in right direction. I am attempting to add a label and datetime picker control side by side in my ribbon bar group. I have managed to get the label and datetime picker to appear on the same row (for lack of a better term) in the group, but they just overlap each other.

I found a similar thread called "Label in Ribbon Bar", which sets positioning of the controls in a panel...then the panel is added to the group as RadHostItem. I tried the suggested code, but it doesn't appear to work, as the ribbon group ended up empty...not displaying any controls. Then I tried without the panel. The label and datetime picker reappeared, but were still overlapped.

I have included a code snippet below. Any insight or help is appreciated.

 RadLabel label = new RadLabel();
 label.Location = new Point(5, 5);
 label.Text = "test";
 RadHostItem item1 = new RadHostItem(label); RadDateTimePicker picker = new RadDateTimePicker();
 picker.Location = new Point(32, 5);
 picker.MinimumSize = new Size(100, 0);
 RadHostItem item2 = new RadHostItem(picker);
 ribbonGroupSettings.Items.AddRange(new RadHostItem[] { item1, item2 }); ribbonGroupSettings.MinSize = new Size(ribbonGroupSettings.Size.Width + label.Width + 100 + padding, 0);  

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Jun 2015, 08:36 AM
Hello Robert,

Thank you for writing.

Here is a sample code snippet, demonstrating how to achieve the illustrated result from the attached screenshot: 
public Form1()
{
    InitializeComponent();
 
    RadRibbonBarGroup mainGroup = new RadRibbonBarGroup();
    mainGroup.Text = "MainGroup";
    this.ribbonTab1.Items.Add(mainGroup);
 
    RadRibbonBarButtonGroup subGroup = new RadRibbonBarButtonGroup();
    subGroup.Orientation = Orientation.Horizontal;
    mainGroup.Items.Add(subGroup);
 
    RadLabelElement label = new RadLabelElement();
    label.Text = "Here is a sample text";
    subGroup.Items.Add(label);
 
    RadDateTimePickerElement dtPicker = new RadDateTimePickerElement();
    dtPicker.MinSize = new System.Drawing.Size(150, 20);
    subGroup.Items.Add(dtPicker);          
}

I hope this information helps. Should you have further questions, I would be glad to help.
 
Regards,
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
RibbonBar
Asked by
Robert
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or