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

Adding controls programatically

1 Answer 96 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 14 Apr 2010, 11:02 PM
I just upgraded to the latest release of WinForms and am trying to add controls to a RibbonBarGroup using the following code:

        private void SetupRibbonBar()  
        {  
            RadLabel lblStartDate = new RadLabel();  
            lblStartDate.Text = "Start Date";  
            lblStartDate.Location = new Point(2, 2);  
 
            RadLabel lblEndDate = new RadLabel();  
            lblEndDate.Text = "End Date";  
            lblStartDate.Location = new Point(2, 24);  
 
            RadDateTimePicker StartDate = new RadDateTimePicker();  
            StartDate.MinimumSize = new Size(150, 20);  
            StartDate.Location = new Point(13, 2);  
            StartDate.Format = DateTimePickerFormat.Short;  
              
            RadDateTimePicker EndDate = new RadDateTimePicker();  
            EndDate.MinimumSize = new Size(150, 20);  
            EndDate.Location = new Point(13, 24);  
            EndDate.Format = DateTimePickerFormat.Short;  
 
            RadPanel panel = new RadPanel();  
            panel.Controls.AddRange(new Control[] { lblStartDate, lblEndDate, StartDate, EndDate });  
              
            RadHostItem item1 = new RadHostItem(panel);  
            this.RibbonBarGroupReportPeriod.Items.Add(item1);  
        }  
 

Everything builds fine, but when I run the project nothing shows up in the RibbonBarGroup.

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 20 Apr 2010, 09:31 AM
Hello Jim,

Thank you for the question.

In order to show RadControls in RadRibbonBar, you need to set the MinSize of both RadPanel and RadRibbonBarGroup. For additional information, please refer to the support ticket that you have opened about the same topic.

Kind regards,
Nikolay
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
Jim
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or