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
3 Answers, 1 is accepted
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.
Vladi
Telerik
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
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