
Hello Team,
Please see the attached screen.Could you please guide me how to implement the custom treeview
5 Answers, 1 is accepted
If you just need to show an image on the right side you can use the NodeFormatting event:
private
void
RadTreeView1_NodeFormatting(
object
sender, Telerik.WinControls.UI.TreeNodeFormattingEventArgs e)
{
e.NodeElement.ContentElement.Image = img;
e.NodeElement.ContentElement.TextImageRelation = TextImageRelation.TextBeforeImage;
e.NodeElement.ContentElement.ImageAlignment = ContentAlignment.MiddleRight;
e.NodeElement.ContentElement.ImageLayout = ImageLayout.None;
e.NodeElement.ContentElement.StretchHorizontally =
true
;
}
I hope this information is useful. Let me know if you need further assistance.
Regards,
Dimitar
Telerik by Progress

Thanks for the reply.
Quickly wanted to check if I can bind class objects to Treeview..something like below
public class Employee
{
public int EmployeeId{get;set;}
public string name {get;set;}
public Image Icon {get;set;}
public IList<Employee> Subordinates{get;set;}
}
so that I can fill this Employee list and bind to RadTreeView. Name property of Employee would be the TreeNode Name and Icon property would appearing next to Text in TreeNode and EmployeeId in hide field so that when user click on Icon, I would get the employee id and execute the business logic.
Regards,
Chandrakala
If your structure has fixed levels count you can use object relational binding: Binding to Object-relational Data.
If you do not know the levels count you can use the load on demand functionality: Load On Demand.
Please do not hesitate to contact us with any additional questions or concerns.
Dimitar
Telerik by Progress

Hello,
Thanks for the reply again. If I place the image after the node text.How to capture the image click event, not the node click event.
Handling the mouse will require adding a separate element that holds the image. This is necessary because currently the image and the text are displayed in a single element and there is no way to determine which part is clicked. I have created a small sample that shows how you can create a custom node and add the new image element.
I hope this will be useful.
Regards,
Dimitar
Telerik by Progress