Adding controls programatically

2 posts, 0 answers
  1. Jim
    Jim avatar
    27 posts
    Member since:
    Jun 2008

    Posted 14 Apr 2010 Link to this post

    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.
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 20 Apr 2010 Link to this post

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