TreeCellContainer image for tasks without children

4 posts, 0 answers
  1. AdrianG
    AdrianG avatar
    17 posts
    Member since:
    Jun 2013

    Posted 24 Oct 2015 Link to this post

    Hi

    This is probably a simple thing to achieve but I'm struggling to come up with the solution!

    For tasks without children there is currently no expand/collapse image displayed in the tree cell as you would expect. However, for tasks without children at level 1 would it be possible to display an image - for example a simple bullet-point style image?

    Many thanks

    Adrian

  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 28 Oct 2015 Link to this post

    Hi Adrian,

    Thank you for contacting us.

    Yes you are correct the "Expand/Collapse" icon is only visible in the TreeCellContainer if that task has child task objects. In order to change this default behavior there are multiple approaches that could be used for example:
    • Edit the control's Theme, find the Style and Template of the TreeCellContainer and edit the Path with x:Name="PART_ExpandCollapseVisual"
    • A simple way that would not require the customization of the control's theme is to create a custom CellTemplate for the TreeColumnDefinition and in that DataTemplate using custom IValueConverter show or hide your custom "bullet-point" element. You can use the CellInfo.OriginalDataItem.CanExpand value to determine if the current GanttTask contains child elements.

    I edited the "CellTemplateBasedOnType" SDK example project located in our GitHub repository in such a way that it illustrates the above described approach, hope this is helpful. You can find the edited project attached to my response.

    If we can be of any further assistance do not hesitate to contact us again.

    Regards,
    Vladi
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. AdrianG
    AdrianG avatar
    17 posts
    Member since:
    Jun 2013

    Posted 28 Oct 2015 in reply to Vladi Link to this post

    Thanks for this Vladi.

    Is there any way I can display the bullet-point icon in the same part of the TreeCellContainer where the expand/collapse icon would normally go? Your example puts the image with the text of the Title which is not quite what I'm after. The attached mock-up might help to illustrate what I mean.

    Many thanks

    Adrian

  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 29 Oct 2015 Link to this post

    Hello Adrian,

    Thank you for clearing the desired behavior.

    By design in the RadGanttView control a GanttTask object can have any number of child GanttTask objects which respectively could have their own children tasks etc. This way you could achieve a multiple level of tasks structure. In order to separate (visually) each "level" of tasks the position (left offset) of the DataTemplate of each task is dynamically calculated in the source code of the control. Because this implementation is internal for the control changing it is not a simple task and has not been fully tested.

    Currently we do not have an example project which demonstrates how to change this behavior of the nested tasks in the control. We will do our best to created such an example and add it to our SDK repository located at GitHub.

    If you have any other questions, let us know.

    Regards,
    Vladi
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top