Custom RadTreeNode

6 posts, 1 answers
  1. Antonio
    Antonio avatar
    27 posts
    Member since:
    Sep 2009

    Posted 18 Nov 2009 Link to this post

    Some time ago I needed to implement progress bars on my radlistboxitems which I found to be pleasantly easy to achieve. I have done similar modifications to radelement trees on a number of the other controls with no problem but I am now keen to modify the radtreeview somewhat - Only nor the radtreeview nor radtreeviewnodes appear to have a radelement tree like the others. The tree is there but it is very simplistic and with absolutely no breakdown of fillprimitives , borderprimitives and the usual layout panels combined with the standard primitives. Am I missing something ? I won't detail every change I am keen to try but one change I really "need" is to be able to implement a progressbar element on a radtreenode .
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 23 Nov 2009 Link to this post

    Hello Antonio,

    Thank you for writing. It is true that RadTreeView does many things differently from the other controls. For example, its layouts are custom and take into account only specific properties. I am afraid that there is no easy way to incorporate custom elements inside the tree nodes because there is no way to make the current layout mechanism include those elements in the calculations.

    Thank you for your understanding. Please write again if you have other questions.

    All the best,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Antonio
    Antonio avatar
    27 posts
    Member since:
    Sep 2009

    Posted 23 Nov 2009 Link to this post

    Thanks for the reply Victor , in the course of my playing around to find a solution I found the RadElement method GetAsBitmap. I see also that the RadTreeView has a DrawNode event that passes a graphics object allowing you quite a bit of drawing functionality. Unfortunately I seem to have no luck returning an image when using it on a RadElement. I continuously get a null from the function. I can't find much direction in the documentation on this function . If I could get the image from a RadElement , then I could , to some degree achieve some of the customisation I want in my RadTreeNode appearances. Perhaps there is somewhere else I could find more detail on the correct use of this function ?

    In particular I would like to get back a RadProgressBarElement as a bitmap.

    Thanks again for your help,
    Antonio.
  5. Answer
    Victor
    Admin
    Victor avatar
    1351 posts

    Posted 26 Nov 2009 Link to this post

    Hi Antonio,

    All RadElements will return null when they are in an invalid state (see ElementState property). In order to be in a valid state an element must be associated with a RadControl instance.
    What you need to do is to create a RadProgressBar control, call its LoadElementTree() method and get the bitmap from the RadProgressBarElement instance that is associated with the control. For example:
    RadProgressBar p = new RadProgressBar();
    p.LoadElementTree();
     
    Image img = p.ProgressBarElement.GetAsBitmap(Brushes.White, 0.0f, new SizeF(1.0f, 1.0f));

    Please write again if you need further assistance.

    Sincerely yours,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 18 Mar 2011 Link to this post

    Hi Antonio,

    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 about this release, please refer to this blog post.

    All the best,
    Stefan
    the Telerik team
  7. Antonio
    Antonio avatar
    27 posts
    Member since:
    Sep 2009

    Posted 18 Mar 2011 Link to this post

    Awesome, thank you.
Back to Top
UI for WinForms is Visual Studio 2017 Ready