I attempted to bind the Image with a datatemplate under columndefinition for the task
but without success.
<
telerik:ColumnDefinition
MemberBinding
=
"{Binding TaskImage}"
Width
=
"AutoHeaderAndContent"
>
<
telerik:ColumnDefinition.CellEditTemplate
>
<
DataTemplate
>
<
Image
Source
=
"{Binding TaskImage}"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
Stretch
=
"Uniform"
/>
<!--<Image Source="../Images/folder_16.png" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Uniform"/>-->
</
DataTemplate
>
</
telerik:ColumnDefinition.CellEditTemplate
>
</
telerik:ColumnDefinition
>
greetings Robert ...
5 Answers, 1 is accepted
You are on the right track on how to achieve an Image Column in the GridView part of the RadGanttView.
To accomplish this we need to add a ColumnDefinition with a custom CellTemplate to the RadGanttView. In the CellTemplate however we should use FormattedValue property instead of the TaskImage property.
Please find attached a sample project demonstrating how to achieve this. I have created an ImageGanttTask that extends the GanttTask by adding an ImagePath property. Then in the xaml I add a ColumnDefinition to the RadGanttView with the custom CellTemplate. This template contains an Image bound to the ImagePath property.
Regards,
Polya
Telerik
Is it also possible to use a Icon at gantview side e.g display at left side from a gantbar?
greetings Robert ...
If I understood correctly the desired customization includes adding the Icon in the GanttTasks in the TimeRuler part of the RadGanttView.
If I am correct, this can be achieved by modifying the ControlTemplate of the EventContainers to include an additional Image.
I've attached the modified project that demonstrates how to achieve the above approach. Note that the project uses Implicit Styles.
More information about styling and theming the RadGanttView can be found on this link.
Regards,
Polya
Telerik
Following the previous example, I would like to achieve the result in the attached image. I would like to be able to add some icons at the right side of the red/green deadline indicator.
Can you please help me with an example on how to do that?
Thanks
RadGanttView provides a way to display custom elements for each task in the Timeline showing additional information.
The approach is demonstrated in our WPF Demos - just check the GanttView Deadline example. This approach consists of:
1. Creating a custom GanttTask and added a, for example, GanttResource property to it.
2. Creating a custom EventInfo (for example, TimeLineResourceEventInfo) that contains the relevant information about the new container you want to add.
3. Creating the custom container (for example, TimeLineResourceContainer) that you want to add and define style for it.
4. Creating a custom ContainerSelector and in its overriden GetContainerType() method return a TimeLineResourceContainer when the passed item is of type TimeLineResourceEventInfo.
5. Creating custom DefaultGanttTimeLineVisualizationBehavior (for example, ResourceTimeLinVisualizationBehavior) that answer for generating the correct EventInfos for each GanttTask. In its overriden GetEventInfos() method create a TimeLineResourceEventInfo for each container. Note that the range of the TimeLineResourceEventInfostarts at from the end of the task.
Regards,
Polya
Telerik by Progress