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

Parent/Child On WPF Gantt Chart not working

2 Answers 187 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 2
Matt asked on 23 Jun 2013, 03:02 AM
Since I don't see any complaints about this feature, I assume that there is something fundamental not mentioned in any documentation or video that somehow activates this functionality, because following the video and online documentation (i.e. the vary basic examples) I NEVER see the parent child setup (expanders and indentation). Any push in the right direction or information about the latest on where the development of the WPF version of this control is would be greatly appreciated. So far, it seems unusable, but I cannot believe that since this control is in released status for WPF; listed as new. First tried it in our application, but then thought the complexities were causing issues. But now I see that the basic application in its own WPF window/project/solution fails as well.

This was built with the just downloaded Q2 2013 6/11 version. No change from Q3 2012 1017 internal build that we were running.

Very frustrating.

<Window x:Class="GanttChart.MainWindow"
        Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <Grid>
        <telerik:RadGanttView Margin="0" Name="radGanttView1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <telerik:RadGanttView.Columns>
                <telerik:ColumnDefinition ColumnWidth="175" Header="Title" MemberBinding="{Binding Title}" />
                <telerik:ColumnDefinition ColumnWidth="175" Header="End"  MemberBinding="{Binding Start}"/>
                <telerik:ColumnDefinition ColumnWidth="175" Header="Start"  MemberBinding="{Binding End}"/>
            </telerik:RadGanttView.Columns>
        </telerik:RadGanttView>
    </Grid>
</Window>
 
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
 
using Telerik.Windows.Controls.GanttView;
using Telerik.Windows.Controls.Scheduling;
 
namespace GanttChart
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            var d = new DateTime(2012, 3, 1);
            radGanttView1.VisibleRange = new VisibleRange(d, d.AddMonths(2));
            var tasks = new ObservableCollection<GanttTask>();
            for (int i = 0; i < 4; i++)
            {
                var gt = new GanttTask(
                              d.AddDays(14 * i),
                              d.AddDays(14 * i + 14),
                             "Title " + i.ToString());
                for (int j = 0; j < gt.Duration.Days; j++)
                {
                    var childGT = new GanttTask();
                    childGT.Start = gt.Start.AddDays(j);
                    childGT.End = childGT.Start.AddHours(23);
                    childGT.Title = "Child " + i.ToString() + "/" + j.ToString();
                    gt.Children.Add(childGT);
 
                }
                tasks.Add(gt);
            }
            radGanttView1.TasksSource = tasks;
            radGanttView1.PixelLength = new TimeSpan(0, 1, 0, 0);
        }
    }
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 26 Jun 2013, 10:59 AM
Hello,

In order for the parent task to be visually rendered as parent (TreeView alike) all you need to do is in the xaml of the control when declaring the RadGanttView Columns set your first column (in this example the Title column) to be of type TreeColumnDefinition. We also noticed that there are no dependencies set when creating the child tasks. In order to set a dependency between tasks all you need to do is add a new object of type Dependency to the Dependencies collection of the GanttTask. More information about the GanttTasks and Dependencies can be found here, and about the different columns in the control here.

I created and attached a sample project for you the previously described approaches, hope this is helpful.

Regards,
Vladi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Matt
Top achievements
Rank 2
answered on 26 Jun 2013, 12:24 PM
Thanks Vladi.

That definitely fixed my issue. My demo works as expected now. I was aware of the dependencies, and had already played with that stuff without the parent/child relationship working.

However, I was not aware of the column requirement. I'll review the demos and documentation again.

Thanks for taking the time to respond!
Tags
GanttView
Asked by
Matt
Top achievements
Rank 2
Answers by
Vladi
Telerik team
Matt
Top achievements
Rank 2
Share this question
or