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

Add a dropDownList in CreateChildElement

2 Answers 147 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Giovanni De Lazzari
Top achievements
Rank 1
Giovanni De Lazzari asked on 16 Nov 2012, 05:53 AM
Hi , I have to do a list of thumb images with on the left side a dropdown to select a print format
but whe I try to add a RadDropDownList
to this.Children in the CreateChildElements event I get this error "unknown method add(Telerik.WinControl.UI.RadDropDownList) of telerik.wincontrol.radElementCollection

here is the code
protected override void CreateChildElements()
         {
             base.CreateChildElements();
 
             this.stackLayout = new StackLayoutPanel();
             this.stackLayout.Orientation = Orientation.Horizontal;
 
             this.contentElement = new LightVisualElement();
               this.contentElement.StretchHorizontally = true;
             this.contentElement.MinSize = new Size(220, 2200);
             this.stackLayout.Children.Add(this.contentElement);
 
             imageElement = new clsBackDropItem(null,160,106);
             imageElement.ImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.stackLayout.Children.Add(this.imageElement);
 
             this.buttonElement2 = new RadButtonElement();
             this.buttonElement2.Text = "Button2";
             this.stackLayout.Children.Add(this.buttonElement2);
 
             this.dd=new RadDropDownList();
             this.stackLayout.Children.Add(this.dd);
             this.Children.Add(this.stackLayout);

thanks in advance for any suggestion
ciao

2 Answers, 1 is accepted

Sort by
0
Giovanni De Lazzari
Top achievements
Rank 1
answered on 17 Nov 2012, 08:00 AM
Again if I try to add a checkBox I get the same error, any  Idea ?
chkBoxSelect = new RadCheckBox();
              chkBoxSelect.Text = "Aggiungi";
              chkBoxSelect.Font=new System.Drawing.Font("Segoe UI", 8, FontStyle.Regular, GraphicsUnit.Point);
              stackLayout.Children.Add(chkBoxSelect);
0
Ivan Todorov
Telerik team
answered on 20 Nov 2012, 02:38 PM
Hi Giovanni,

Thank you for your question.

The Children collection of our elements can contain only instances that inherit from the base RadElement class and the RadDropDownList and RadCheckBox inherit from the RadControl class. This is how our Telerik Presentation Framework is designed. Each RadControl has a RootElement which is a special inheritor of the RadElement class and it hold the main element for a control. Here you can find more about the class hierarchy in the TPF.

In your case, you should use RadCheckBoxElement instead of RadCheckBox, and RadDropDownListElement instead of RadDropDownList (these are the main elements of the respective controls).

Should you have any additional questions, do not hesitate to write back.

Greetings,
Ivan Todorov
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
ListView
Asked by
Giovanni De Lazzari
Top achievements
Rank 1
Answers by
Giovanni De Lazzari
Top achievements
Rank 1
Ivan Todorov
Telerik team
Share this question
or