Hi,
We have a RadTreeView in our RadDropDownList based on the sample found here:
http://www.telerik.com/community/forums/winforms/combobox-and-listbox/treeview-in-dropdown.aspx
But we seem to have some issues with it:
If the 'Arrow Button' is clicked while the popup is open, then the 'arrow button' gets stuck as if it's still pressed but the popup itself is not showing. Once in this mode, any further clicks on the arrow button will display the popup and immediately close it again.
This behavior is also reproducible in the sample attached in the forum post.
I hope anyone has a way of getting around this.
Thank you in advance.
Carsten.
We have a RadTreeView in our RadDropDownList based on the sample found here:
http://www.telerik.com/community/forums/winforms/combobox-and-listbox/treeview-in-dropdown.aspx
But we seem to have some issues with it:
If the 'Arrow Button' is clicked while the popup is open, then the 'arrow button' gets stuck as if it's still pressed but the popup itself is not showing. Once in this mode, any further clicks on the arrow button will display the popup and immediately close it again.
This behavior is also reproducible in the sample attached in the forum post.
I hope anyone has a way of getting around this.
Thank you in advance.
Carsten.
10 Answers, 1 is accepted
0
Hello Carsten,
Thank you for contacting Telerik Support.
In order to apply the provided solution to RadDropDownList and the embedded RadTreeView in its pop up, you may use the following approach:
Please note that the referred solution in the forum thread is not a generic solution and it may not work correctly in all scenarios. Feel free to modify the approach according to your needs.
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Thank you for contacting Telerik Support.
In order to apply the provided solution to RadDropDownList and the embedded RadTreeView in its pop up, you may use the following approach:
RadHostItem h;
RadTreeView radTreeView1;
public
Form1()
{
InitializeComponent();
this
.radTreeView1 =
new
RadTreeView();
for
(
int
i = 0; i < 50; i++)
{
RadTreeNode node =
new
RadTreeNode();
node.Text =
"Node"
+ i.ToString();
this
.radTreeView1.Nodes.Add(node);
}
this
.radTreeView1.Dock = DockStyle.Fill;
h =
new
RadHostItem(
this
.radTreeView1);
this
.radDropDownList1.DropDownMinSize =
new
Size(
this
.radDropDownList1.Width, 60);
this
.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged;
if
(
this
.radDropDownList1.DropDownListElement.ListElement.Parent !=
null
)
{
this
.radDropDownList1.DropDownListElement.ListElement.Children.Insert(0, h);
}
}
private
void
radTreeView1_SelectedNodeChanged(
object
sender, RadTreeViewEventArgs e)
{
this
.radDropDownList1.DropDownListElement.ClosePopup();
this
.radDropDownList1.Text =
this
.radTreeView1.SelectedNodes[0].Text;
}
Please note that the referred solution in the forum thread is not a generic solution and it may not work correctly in all scenarios. Feel free to modify the approach according to your needs.
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0

Carsten
Top achievements
Rank 1
answered on 12 Dec 2013, 10:24 AM
Hi Desislava,
That's awesome, it seems to work, thank you so much!
That's awesome, it seems to work, thank you so much!
0
Hello Carsten,
I am glad that the issue you were facing is now resolved. Please do not hesitate to contact us if you have any additional questions.
Regards,
Desislava
Telerik
I am glad that the issue you were facing is now resolved. Please do not hesitate to contact us if you have any additional questions.
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0

Peter
Top achievements
Rank 1
answered on 03 Jun 2014, 04:08 PM
Hi All,
I was able to integrate a RadTreeView into the RadDropDownList with the approach suggested by Desislava.
Can you give me an example how to enable scrolling by mousewheel and arrow keys?
Thank you very much in advance,
Peter
I was able to integrate a RadTreeView into the RadDropDownList with the approach suggested by Desislava.
Can you give me an example how to enable scrolling by mousewheel and arrow keys?
Thank you very much in advance,
Peter
0
Hello Peter,
Thank you for writing.
You can achieve scrolling on mouse wheel for the RadTreeView hosted in the DropDownPopupForm following the approach below:
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Thank you for writing.
You can achieve scrolling on mouse wheel for the RadTreeView hosted in the DropDownPopupForm following the approach below:
RadHostItem h;
RadTreeView radTreeView1;
MethodInfo mi;
public
Form1()
{
InitializeComponent();
this
.radTreeView1 =
new
RadTreeView();
for
(
int
i = 0; i < 50; i++)
{
RadTreeNode node =
new
RadTreeNode();
node.Text =
"Node"
+ i.ToString();
this
.radTreeView1.Nodes.Add(node);
}
mi = radTreeView1.TreeViewElement.GetType().GetMethod(
"ProcessMouseWheel"
,
BindingFlags.NonPublic | BindingFlags.Instance);
this
.radTreeView1.Dock = DockStyle.Fill;
h =
new
RadHostItem(
this
.radTreeView1);
this
.radDropDownList1.DropDownMinSize =
new
Size(
this
.radDropDownList1.Width, 60);
this
.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged;
if
(
this
.radDropDownList1.DropDownListElement.ListElement.Parent !=
null
)
{
this
.radDropDownList1.DropDownListElement.ListElement.Children.Insert(0, h);
}
this
.radDropDownList1.PopupOpened += radDropDownList1_PopupOpened;
}
private
void
radDropDownList1_PopupOpened(
object
sender, EventArgs e)
{
RadDropDownListElement ddle = sender
as
RadDropDownListElement;
ddle.Popup.MouseWheel -= ddle_MouseWheel;
ddle.Popup.MouseWheel += ddle_MouseWheel;
}
private
void
ddle_MouseWheel(
object
sender, MouseEventArgs e)
{
DropDownPopupForm popup = sender
as
DropDownPopupForm;
RadTreeView tree = popup.Controls[0]
as
RadTreeView;
if
(tree !=
null
&& mi !=
null
)
{
mi.Invoke(tree.TreeViewElement,
new
object
[] { e });
}
}
private
void
radTreeView1_SelectedNodeChanged(
object
sender, RadTreeViewEventArgs e)
{
this
.radDropDownList1.DropDownListElement.ClosePopup();
this
.radDropDownList1.Text =
this
.radTreeView1.SelectedNodes[0].Text;
}
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0

Mudasser
Top achievements
Rank 1
answered on 19 Oct 2015, 08:14 AM
Hi,
We need to search through the RadTreeView nodes using the RadDropDownList control with DropdownStyle = DropDown.
Is there anyway that as we write any text in the text area of DropDownList and it automatically show the relevant tree nodes in the popup?
Thanks
Mudasser Hameed
0
Hello Mudasser,
Thank you for writing.
You can subscribe to the DropDownListElement.TextBox.TextChanged event and filter the tree view by setting the RadTreeView.Filter property:
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik
Thank you for writing.
You can subscribe to the DropDownListElement.TextBox.TextChanged event and filter the tree view by setting the RadTreeView.Filter property:
RadHostItem h;
RadTreeView radTreeView1;
MethodInfo mi;
public
Form1()
{
InitializeComponent();
this
.radTreeView1 =
new
RadTreeView();
for
(
int
i = 0; i < 50; i++)
{
RadTreeNode node =
new
RadTreeNode();
node.Text =
"Node"
+ i.ToString();
this
.radTreeView1.Nodes.Add(node);
}
mi = radTreeView1.TreeViewElement.GetType().GetMethod(
"ProcessMouseWheel"
,
BindingFlags.NonPublic | BindingFlags.Instance);
this
.radTreeView1.Dock = DockStyle.Fill;
h =
new
RadHostItem(
this
.radTreeView1);
this
.radDropDownList1.DropDownMinSize =
new
Size(
this
.radDropDownList1.Width, 60);
this
.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged;
if
(
this
.radDropDownList1.DropDownListElement.ListElement.Parent !=
null
)
{
this
.radDropDownList1.DropDownListElement.ListElement.Children.Insert(0, h);
}
this
.radDropDownList1.PopupOpened += radDropDownList1_PopupOpened;
this
.radDropDownList1.DropDownListElement.TextBox.TextChanged += TextBox_TextChanged;
}
private
void
TextBox_TextChanged(
object
sender, EventArgs e)
{
this
.radDropDownList1.DropDownListElement.ShowPopup();
this
.radTreeView1.Filter =
this
.radDropDownList1.DropDownListElement.TextBox.Text;
}
private
void
radDropDownList1_PopupOpened(
object
sender, EventArgs e)
{
RadDropDownListElement ddle = sender
as
RadDropDownListElement;
ddle.Popup.MouseWheel -= ddle_MouseWheel;
ddle.Popup.MouseWheel += ddle_MouseWheel;
}
private
void
ddle_MouseWheel(
object
sender, MouseEventArgs e)
{
DropDownPopupForm popup = sender
as
DropDownPopupForm;
RadTreeView tree = popup.Controls[0]
as
RadTreeView;
if
(tree !=
null
&& mi !=
null
)
{
mi.Invoke(tree.TreeViewElement,
new
object
[] { e });
}
}
private
void
radTreeView1_SelectedNodeChanged(
object
sender, RadTreeViewEventArgs e)
{
this
.radDropDownList1.DropDownListElement.ClosePopup();
this
.radDropDownList1.Text =
this
.radTreeView1.SelectedNodes[0].Text;
}
I hope this information helps. Should you have further questions I would be glad to help.
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
.gif)
Gilbert
Top achievements
Rank 1
answered on 04 Jul 2018, 09:15 AM
Please Helpļ¼When I use a DataTable object as the RadTreeView`s DataSource the treeview doesn`t show when the RadDropDownList popup.
0
Hello, Gilbert,
If you add the RadTreeView programmatically and bind it to a DataTable, it is necessary to initialize its BindingContext before setting the DataSource property.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
If you add the RadTreeView programmatically and bind it to a DataTable, it is necessary to initialize its BindingContext before setting the DataSource property.
this
.radTreeView1 =
new
RadTreeView();
DataTable dt =
new
DataTable();
dt.Columns.Add(
"Id"
,
typeof
(
int
));
dt.Columns.Add(
"Name"
,
typeof
(
string
));
for
(
int
i = 0; i < 10; i++)
{
dt.Rows.Add(i,
"Node"
+i);
}
this
.radTreeView1.BindingContext =
new
BindingContext();
this
.radTreeView1.DataSource = dt;
this
.radTreeView1.DisplayMember =
"Name"
;
this
.radTreeView1.ValueMember =
"Id"
;
I hope this information helps. If you have any additional questions, please let me know.
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0
.gif)
Gilbert
Top achievements
Rank 1
answered on 05 Jul 2018, 01:02 AM
Hiļ¼Dess
It works.Thank you for your help!