Label in Ribbon Bar

6 posts, 0 answers
  1. Ching-Yen
    Ching-Yen avatar
    65 posts
    Member since:
    Nov 2007

    Posted 17 Mar 2008 Link to this post

    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.
  2. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 18 Mar 2008 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ching-Yen
    Ching-Yen avatar
    65 posts
    Member since:
    Nov 2007

    Posted 19 Mar 2008 Link to this post

    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.
  5. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 20 Mar 2008 Link to this post

    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
  6. DenisCL
    DenisCL avatar
    69 posts
    Member since:
    Dec 2009

    Posted 13 Apr 2011 Link to this post

    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
  7. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 18 Apr 2011 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready