I found the online demos for the ASP.Net RadTree, but did not see any samples for their windows counterpart.
Thank you.
8 Answers, 1 is accepted
For one, it shows the control on a panel below the form, not on the form itself. In the .cs code I am doing this:
InitializeComponent();
List<NameValue> list = new List<NameValue>();
list.Add(new NameValue("node1", "value1"));
list.Add(new NameValue("node2", "value2"));
list.Add(new NameValue("node3", "value3"));
radTreeView1.DisplayMember = "ID";
radTreeView1.ValueMember = "Value";
radTreeView1.DataSource = list;
I do not see the tree displayed on the form with these 3 nodes.
I have Winforms Q1 2007.
Do you have an idea what is going on?
You can find the online documentation of RadControls for WinForms here:
http://www.telerik.com/help/winforms/Q3_2007/
Here is a help article showing how one can bind a RadTreeView to a List (as in your sample code):
http://www.telerik.com/help/winforms/Q3_2007/RadTreeDataBasics.html
Here is another help article explaining how to use context menus with RadTreeView:
http://www.telerik.com/help/winforms/Q3_2007/RadTreeDesignContextMenus.html
I hope that helps. If you have any further questions do not hesitate to ask.
Greetings,
Jordan
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Can you please point me to sample code that illustrates how to control the appearance of a radTreeView using themes and styles? Specifically based on some application logic I want to change the background of certain leaf nodes in the tree.
Also, there is a RadMenu object in the ToolBox and a RadMenuStrip object in documentation. Can any of these be used for rendering context menus? I am using the RadDropDownMenu for rendering my context menu.
Thank you in advance.
When I right click and select an option from the context menu, I want to determine the node of the tree on which the context menu was clicked.
Note that this node may not be selected at this point.
Thank you.
To control the appearance of RadTreeNode you have to use some of its properties, such as ForeColor, ForeColor2, BorderColor, BackColor, BackColor2, BackColor3. BackColor4. GradientAngle, GradientPercentage, GradientPercentage2, GradientStyle and NumberOfColors. These are used to control the visual appearance of any Telerik WinForms control. Please, review the documentation on how to change the visual appearance of the controls.
To determine the node of the tree on which the context menu was clicked, subscribe to the MouseUp event of RadTreeView and then add the following code:
void radTreeView1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
RadTreeNode node = this.radTreeView1.GetNodeAt(e.Location.X, e.Location.Y);
if (node != null)
{
// TO DO
}
}
}
As to RadMenu and RadMenuStip - they are the same objects. We will rename them all to RadMenuStrip in one of the future versions. The RadDropDownMenu you are currently using should help you achieve your goal.
This should help you. Please write us back if you have other questions.
Regards,
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Can you please tell me how can I search for nodes by text in a RadTree?
I see a FindNodeByText on the ASP.Net RadTree but no equivalent on the windows forms RadTree.
Thank you.
Currently, RadTreeView does not support the FindNodeByText feature. This issue will be addressed for the Q1 2008 release. For the time being, please refer to the following code snippet representing the implementation of the method:
RadTreeNode FindNodeByText(RadTreeNodeCollection nodeCollection, string text) |
{ |
foreach (RadTreeNode node in nodeCollection) |
{ |
if ((node.Text == text) && (node != this.radTreeView1.SelectedNode)) |
{ |
return node; |
} |
RadTreeNode result = this.FindNodeByText(node.Nodes, text); |
if (result != null) |
{ |
return result; |
} |
} |
return null; |
} |
I hope this helps. If you have additional questions, do not hesitate to contact me.
Regards,
Nikolay
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out. For more information on our latest release refer to this blog post.
Kind regards,Stefan
the Telerik team