RadButtons not rendering the same way in two different tabs.

2 posts, 0 answers
  1. Gabriel
    Gabriel avatar
    6 posts
    Member since:
    Nov 2019

    Posted 06 Dec 2019 Link to this post

    Hi.

    On a form, I am programmaticaly creating radButtons in tow different tabPages. The UI is rendered correctly in the first tab (see "Tab1.png") but not in the second ("Tab2.png"). They are generated the same way:

    // For tab 1
    RadButton b = new RadButton();
    b.EnableTheming = true;
    b.ThemeName = new DesertTheme().ThemeName;
    b.Name = n;
    b.Text = n;
    b.Left = 10;
    b.Top = (22 * i++);
    b.MinimumSize = new Size(ptp1.Width - 40, 20);
    b.MaximumSize = new Size(ptp1.Width - 40, 0);
    b.AutoSize = true;
    b.Padding = new Padding(4);
    ((TextPrimitive)b.ButtonElement.Children[1].Children[1]).TextWrap = true;
    b.RootElement.StretchVertically = false;
    b.TextAlignment = ContentAlignment.MiddleCenter;
    b.Click += new EventHandler(onBtnRechercheClick);
    tt.SetToolTip(b, b.Name);
    ptp1.WindowsControl.Controls.Add(b);

     

    // For tab 2

    RadButton b2 = new RadButton();

    b2.EnableTheming = true;
    b2.ThemeName = new DesertTheme().ThemeName;
    b2.Name = n2;
    b2.Text = n2;
    b2.Left = 10;
    b2.Top = (22 * i2++);
    b2.MinimumSize = new Size(ptp2.Width - 40, 20);
    b2.MaximumSize = new Size(ptp2.Width - 40, 0);
    b2.AutoSize = true;
    b2.Padding = new Padding(4);
    ((TextPrimitive)b2.ButtonElement.Children[1].Children[1]).TextWrap = true;
    b2.RootElement.StretchVertically = false;
    b2.TextAlignment = ContentAlignment.MiddleCenter;
    b2.Click += onBtnRechercheClick;
    tt.SetToolTip(b2, b2.Name);
    ptp2.WindowsControl.Controls.Add(b2);

  2. Nadya
    Admin
    Nadya avatar
    241 posts

    Posted 11 Dec 2019 Link to this post

    Hello Gabriel,

    According to the provided information, it seems that you have added the buttons in RadPageView. Please note that the elements inside each page in the RadPageView are loaded on-demand. To ensure that the specified layout will be applied to the pages I can suggest you to select each page programmatically in the Load event of the form.

    I have prepared a sample project by using the provided code snippet. Could you please give it a try and let me know how it works for you? The result on my end is demonstrated in the attached gif file. However, if you are still experiencing any further difficulties, I would kindly ask you to modify the project in order to demonstrate the undesired behavior that you are facing and get it back to me. Thus, we would be able to make an adequate analysis of the precise case and assist you further. Thank you in advance.

    I am looking forward to your reply.

    Regards,
    Nadya
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top