Custom Control TReeview For WinForms

6 posts, 0 answers
  1. chandrakala
    chandrakala avatar
    5 posts
    Member since:
    Feb 2011

    Posted 23 Jan 2017 Link to this post

    Hello Team,

     

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

     

     

  2. Dimitar
    Admin
    Dimitar avatar
    2563 posts

    Posted 24 Jan 2017 Link to this post

    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.
  3. chandrakala
    chandrakala avatar
    5 posts
    Member since:
    Feb 2011

    Posted 24 Jan 2017 in reply to Dimitar Link to this post

    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

     

  4. Dimitar
    Admin
    Dimitar avatar
    2563 posts

    Posted 24 Jan 2017 Link to this post

    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.
  5. chandrakala
    chandrakala avatar
    5 posts
    Member since:
    Feb 2011

    Posted 24 Jan 2017 in reply to Dimitar Link to this post

    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.

  6. Dimitar
    Admin
    Dimitar avatar
    2563 posts

    Posted 24 Jan 2017 Link to this post

    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.
Back to Top