Completed
Last Updated: 31 Jan 2024 11:39 by ADMIN
Release 2024 Q1 (2024.1.130)
W
Created on: 22 Nov 2023 17:07
Category: TabbedForm
Type: Bug Report
0
RadTabbedForm: Exception is thrown when populating design time Left/RightItems collection from the Edit UI Elements option

Hello,

By referring to

https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/tabbedform/getting-started

I created a RabTabbedForm instance; however WinForms designer was not enabled by default and the form could not be designed visually.  How would you recommend?

Additional questions by the way,

1. Is there an easy way to switch on the WinForms DPI awareness for the Telerik forms?

2. At the RadTabbedForm header I see button controls can be added to the left and right sections; can other types of controls be added into these sections, for instance, dropdown buttons, toggle switches etc?

Thank you for your time!

7 comments
ADMIN
Dinko | Tech Support Engineer
Posted on: 28 Nov 2023 11:16

Hi Wei Wu,

Thank you for the updated project.

The exception indeed is observed runtime. This is quite interesting as I wasn't able to observe it the first time. It turns out that I never tested it runtime, only in design time. Accept my apologies for that. To double check I have created several projects with several RadTabbedForm. Each of them reproduces the same exception when populating the Left and RightItems collections. I have forwarded this to our development team and after a brief discussion, it turns out that it is not intended to populate these collections from the Edit UI elements options. Using this way we are modifying the visual tree which is recreated runtime. To make this work we need to use the properties windows in Visual Studio.

This does not mean the approach that I used in the first place should be left this way. I am converting this ticket thread to a Feedback Item so that the community can take advantage of our conversation. This behavior should be fixed or at least remove the Left/RightItems collection from the Edit UI Elements option.

I am updating your Telerik Points for bringing this behavior to our attention.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

W
Posted on: 27 Nov 2023 19:46

Hello Dinko,

Thank you for your example!  Sorry I did not explain well; the programming approach to add controls works.  The approach to use "Edit UI Elements" in designer does not.  I suspect the auto produced code from designer has issues.  I tried to add a couple of controls in your example project and attach it.  You can see the added controls to the RightItems in the designer; however at runtime it triggered an exception.  Thank you in advance for your help!

Best regards,

Attached Files:
ADMIN
Dinko | Tech Support Engineer
Posted on: 27 Nov 2023 09:21

Hi Wei Wu,

Thank you for the provided details.

I am not sure why this error appears on your side. If you can share the project I could check it out and try to find out why this exception occurs. I am attaching my sample project which was used to generate the images in the previous post. You can check it out and compare the project with yours if sending me your project is not an option.

I am looking forward to your reply.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Attached Files:
W
Posted on: 24 Nov 2023 16:59

Hello Dinko,

Thanks a lot for your time and patience to explain!  I haven't found any documentation regarding this approach.  It works as I followed your steps.  I can see the controls on the designer view.  However when I run the program, I have got an exception as below.  I tried a few times and could not get rid of the exception.  Thank you in advance if you can spare time to help!

Best regards,

ADMIN
Dinko | Tech Support Engineer
Posted on: 24 Nov 2023 11:20

Hello Wei Wu,

Yes, you can. I will show you step by step, how you can do that.

By default, you can use the designer to populate the LeftItems or RightItems collection with different elements. To do that you need to first open the Smart Tag of the RadTabbedForm in the designer. Then select the Edit UI Elements:

When the Element hierarchy editor dialog is open, select the RadTabbedFormControlElement in the navigation tree. On the right side search for LeftItems or RightItems (depending on which you want to customize). Select the RightItems (or LeftItems) value and click on the three-dot button.

The RadItem Collection Editor dialog will be open. The drop-down Add button exposes various elements that can be added to the collection.

For the purpose of this example, I will add a button and a checkbox. When selecting an element you can click on it on the left side and customize its properties on the right side.

Click OK to add the button and close all dialogs. You can see the button and the checkbox in the designer.

I hope that the above steps are clear enough to demonstrate how you can populate the mentioned collection design time.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

W
Posted on: 24 Nov 2023 05:12

Hello,

Thank you for your time and your answers are very helpful!  Regarding the left and right elements, your example source code works; so I can only achieve this by programming?  Instead can I add the control types and set their properties in the WinForms designer?

Thanks again!

ADMIN
Dinko | Tech Support Engineer
Posted on: 23 Nov 2023 14:41

Hi Wei Wu,

Thank you for reaching out to us. I will follow your questions below:

  • I created a RabTabbedForm instance; however, WinForms designer was not enabled by default and the form could not be designed visually.  How would you recommend?

If you mean programmatically adding tab elements to the form, you can populate the RadTabbedFormControl.Controls collection. Then you can create RadTabbedFormControlTab objects and add them to the Controls collection.

public partial class Form1 : RadTabbedForm
{
    public Form1()
    {
        InitializeComponent();
        this.radTabbedFormControl1.Controls.Add(new RadTabbedFormControlTab("Manual Tab"));
    }
}

Here is the result:

  • Is there an easy way to switch on the WinForms DPI awareness for the Telerik forms?

You can check the How to Enable HDPI Support in Your Application section in our documentation which describes how you can enable the DPI in your application.

  • At the RadTabbedForm header I see button controls can be added to the left and right sections; can other types of controls be added to these sections, for instance, dropdown buttons, toggle switches etc?

Yes, you can. The left or right elements are exposed by the LeftItems or RightItems collection. You can populate these collections with control element objects. Here is an example:

this.radTabbedFormControl1.LeftItems.Add(new RadDropDownButtonElement());
this.radTabbedFormControl1.RightItems.Add(new RadToggleSwitchElement());

You could check the Introducing the Telerik Presentation Framework help article which describes how our controls are designed.

I hope that I was able to answer your questions. If further assistance is required, feel free to contact us again.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.