This is a migrated thread and some comments may be shown as answers.

icon

5 Answers 153 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
robert
Top achievements
Rank 1
robert asked on 07 Jul 2014, 08:44 AM
hello, is it possible to add a Picture/Icon for each Task at gridview part side?
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

Sort by
0
Polya
Telerik team
answered on 08 Jul 2014, 08:57 AM
Hi Robert,

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
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
robert
Top achievements
Rank 1
answered on 09 Jul 2014, 01:07 PM
Thank you for your help and sample. It work's now.
Is it also possible to use a Icon at gantview side e.g display at left side from a gantbar?
greetings Robert ...
0
Polya
Telerik team
answered on 10 Jul 2014, 11:28 AM
Hello 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
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Andrea
Top achievements
Rank 1
answered on 08 May 2017, 03:25 PM

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

0
Polya
Telerik team
answered on 10 May 2017, 01:41 PM
Hi Andrea,

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.

Hope this helps.

Regards,
Polya
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GanttView
Asked by
robert
Top achievements
Rank 1
Answers by
Polya
Telerik team
robert
Top achievements
Rank 1
Andrea
Top achievements
Rank 1
Share this question
or