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

Custom Control TReeview For WinForms

5 Answers 111 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
chandrakala
Top achievements
Rank 1
chandrakala asked on 23 Jan 2017, 02:59 PM

Hello Team,

 

Please see the attached screen.Could you please guide me how to implement the custom treeview

 

 

5 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 24 Jan 2017, 07:35 AM
Hello Chandrakala,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
chandrakala
Top achievements
Rank 1
answered on 24 Jan 2017, 08:10 AM

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

 

0
Dimitar
Telerik team
answered on 24 Jan 2017, 09:20 AM
Hi 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. 
 
Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
chandrakala
Top achievements
Rank 1
answered on 24 Jan 2017, 10:18 AM

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.

0
Dimitar
Telerik team
answered on 24 Jan 2017, 12:20 PM
Hello Chandrakala,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Treeview
Asked by
chandrakala
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
chandrakala
Top achievements
Rank 1
Share this question
or