To reproduce: run the attached sample project.
private List<String> dropdownValues = new List<string> {"123", "abc", "!@#"};
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
radDropDownList1.DataSource = dropdownValues;
RadButton b = null;
RadDropDownList ddl = null;
using (var bg = new BackgroundWorker())
{
bg.DoWork += (s, e1) =>
{
Type t =typeof(RadDropDownList);
ddl = (RadDropDownList) Activator.CreateInstance(t);
ddl.DataSource = dropdownValues.OrderBy(l=>l);
};
bg.RunWorkerCompleted += (s, e1) =>
{
this.BeginInvoke(new Action(() =>
{
//this.Controls.Add(b);
this.Controls.Add(ddl);
}));
};
bg.RunWorkerAsync();
}
}
Workaround: initialize the RadDropDownLIst outside the DoWork event handler.