We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Tasknode Template

Good afternoon,

I would like to ask you if it is possible to set, in the scheduling view, 2 task in line and apply a different template to each one.

I would like to achieve something like you can see on the following image, but instead having the milestone I would like to have an image.



I look forward to your reply.

Best regards,

Daniel

Attachment: syncfusion_example_a86eb8f5.7z

3 Replies

MK Muneesh Kumar G Syncfusion Team January 22, 2019 12:26 PM UTC

Hi Daniel, 
 
Greetings from Syncfusion. 
 
We have analysed the reported query and we suspect that you are using resource view gantt in your application. You can add multiple task in a single row as per the below code snippet. 
 
Code snippet: 
MainWindow.Xaml  
<gantt:GanttControl x:Name="Gantt" 
                                ItemsSource="{Binding TeamDetails}" 
                                ShowDateWithTime="True" 
                                ShowNonWorkingHoursBackground="False" 
                                ShowChartLines="False" 
                                ToolTipTemplate="{StaticResource toolTipTemplate}" 
                                VisualStyle="Metro">
  <gantt:GanttControl.TaskAttributeMapping> 
                    <gantt:TaskAttributeMapping TaskNameMapping="Name" 
                                                StartDateMapping="StartDate"  
                                                ChildMapping="SubItems" 
                                                FinishDateMapping="FinishDate" 
                                                ProgressMapping="Progress" 
                                                InLineTaskMapping="InLineItems"/> 
                </gantt:GanttControl.TaskAttributeMapping>

MainWindow.Xaml.cs
public
ObservableCollection<Item> GetTeamInfo() 
        { 
            DateTime dtS = DateTime.Today; 
 
            ObservableCollection<Item> teams = new ObservableCollection<Item>(); 
 
            teams.Add(new Item() { Name = "RDU Team" }); 
            Item Person = new Item() { Name = "Robert" };
// Milestone
 
            Person.InLineItems.Add(new Item() { StartDate = new DateTime(2012, 01, 07), FinishDate = new DateTime(2012, 01, 07), Name = "Market Analysis", Progress = 50d }); 
            Person.InLineItems.Add(new Item() { StartDate = new DateTime(2012, 01, 11,12,0,0), FinishDate = new DateTime(2012, 01, 17), Name = "Competitor Analysis", Progress = 20d }); 
            Person.InLineItems.Add(new Item() { StartDate = new DateTime(2012, 01, 17,12,0,0), FinishDate = new DateTime(2012, 01, 21), Name = "Design Spec" }); 
            teams[0].SubItems.Add(Person); 
   return teams;
       }
 
 
 
We have prepared a sample by adding a Milestone and a task in a single row as like your given image. Please check the sample from the following link.  
 

Screenshot:


Please check our UG documentation link to know more about Resource view gantt items

 
https://help.syncfusion.com/wpf/gantt/resource-view-gantt-inline-items

If your requirement different than this, please give more information about your requirement that would be helpful for us to give better solution in this.
 
 
Regards, 
Muneesh Kumar G. 
 



DP Daniel Pagano January 22, 2019 01:14 PM UTC

Hi Muneesh Kumar G.,

Thank you for your answer, but I was asking you if it is possible to have 2 task in the same row and with different templates.

As you can see in the image that i sent you yesterday I would like to achieve:

2 task in line, but the firstone instead of a milestone I would like to have an image.


MK Muneesh Kumar G Syncfusion Team January 23, 2019 09:35 AM UTC

Hi Daniel, 

Thanks for your update. We have analysed the reported requirement, and this can be achieved by adding a new template for Milestone Style and add image in that style for displaying image instead of milestone.  
 
Code snippet: 
<Style x:Key="MileStone" TargetType="gchart:MileStone"> 
            <Setter Property="Template"> 
                <Setter.Value> 
                    <ControlTemplate TargetType="gchart:MileStone"> 
                        <Grid> 
                            <Image Source="image.png" Height="19" Width="19"/> 
                        </Grid> 
                    </ControlTemplate> 
                </Setter.Value> 
            </Setter>
</
Style>
    <gantt:GanttControl.Resources> 
                <Style BasedOn="{StaticResource MileStone}" TargetType="gchart:MileStone" /> 
            </gantt:GanttControl.Resources> 
 
 
Sample:  
 
Screenshot:


Check our following UG documentation link for how to add custom node style for header, gantt and milestone

https://help.syncfusion.com/wpf/gantt/custom-node-style

Please let us know if you have any other queries.

Regards,
 
Muneesh Kumar G.  
 


Loader.
Live Chat Icon For mobile
Up arrow icon