-
Notifications
You must be signed in to change notification settings - Fork 21
890013 - GanttControl example code and image changes #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d24b518
5b90bce
aa5afd9
8c88b98
d05f62c
1226e17
5d8c6c7
4a3d799
78842c0
9a89e83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,13 +17,13 @@ Gantt control is composed of three controls. They are: | |
| * ScheduleHeader | ||
| * GanttChartVisualControl | ||
|
|
||
|  | ||
|  | ||
|
|
||
| #### Gantt grid | ||
|
|
||
| Gantt Grid is a table view control which displays the scheduled tasks/activities of the project with its hierarchy. You can edit the fields of the bounded tasks using this grid. | ||
|
|
||
|  | ||
|  | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Border around gantt can be added. |
||
|
|
||
| * Header— Header represents the table header which contains the field name of the task. | ||
| * Parent Task—Parent task represents the summary of the child tasks. This is an activity which will be further split into various child tasks. | ||
|
|
@@ -34,7 +34,7 @@ Gantt Grid is a table view control which displays the scheduled tasks/activities | |
|
|
||
| Gantt Chart is an items control which provides a graphically representation of the task/activity that are currently scheduled. Gantt Chart have different components to represent the type of Task, Progress of the Task and Relationship between Tasks. | ||
|
|
||
|  | ||
|  | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no border added around gantt.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
|
|
||
| * Node— Node represents an individual or child task. | ||
| * Header Node—HeaderNode represents the parent or summary task of the projects. | ||
|
|
@@ -88,16 +88,10 @@ You can add Gantt control to the application using the following code: | |
| {% tabs %} | ||
|
|
||
| {% highlight xaml %} | ||
|
|
||
| <Sync:GanttControl x:Name="Gantt" /> | ||
|
|
||
| <syncfusion:GanttControl x:Name="ganttControl" /> | ||
| {% endhighlight %} | ||
|
|
||
| {% highlight c# %} | ||
|
|
||
| //Initializing Gantt | ||
| GanttControl Gantt = new GanttControl(); | ||
|
|
||
| GanttControl ganttControl = new GanttControl(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add below code. Standard code behavior and then work. this.Content = ganttControl; |
||
| {% endhighlight %} | ||
|
|
||
| {% endtabs %} | ||
|
|
@@ -113,99 +107,92 @@ Create a collection of tasks and bind it to the newly created GanttControl as gi | |
|
|
||
| {% highlight xaml %} | ||
|
|
||
| <Sync:GanttControl ItemsSource="{Binding TaskCollection}"> | ||
| <Sync:GanttControl.DataContext> | ||
| <syncfusion:GanttControl x:Name="ganttControl" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getting-Started_img4 - is this image required?, where it is used?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ItemsSource="{Binding TaskDetails}"> | ||
| <syncfusion:GanttControl.DataContext> | ||
| <local:ViewModel></local:ViewModel> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use this code. syncfusion:GanttControl.DataContext |
||
| </Sync:GanttControl.DataContext> | ||
| </Sync:GanttControl> | ||
| </syncfusion:GanttControl.DataContext> | ||
| </syncfusion:GanttControl> | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% highlight c# %} | ||
|
|
||
| //Initializing Gantt | ||
| GanttControl Gantt = new GanttControl(); | ||
| ViewModel model= new ViewModel(); | ||
| this.Gantt.DataContext = model; | ||
| Gantt.ItemsSource = model.GanttItemSource; | ||
| GanttControl ganttControl = new GanttControl(); | ||
| this.ganttControl.ItemsSource = new ViewModel().TaskDetails; | ||
| this.Content = ganttControl; | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% endtabs %} | ||
|
|
||
| {% highlight c# %} | ||
|
|
||
| [C#] | ||
| {% highlight c# tabtitle="ViewModel.cs" %} | ||
|
|
||
| public class ViewModel | ||
| { | ||
| public ObservableCollection<TaskDetails> TaskCollection { get; set; } | ||
| public ViewModel() | ||
| { | ||
| TaskCollection = this.GetDataSource(); | ||
| taskDetails = this.GetTaskDetails(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use prefix of |
||
| } | ||
|
|
||
| private ObservableCollection<TaskDetails> GetDataSource() | ||
|
|
||
| private ObservableCollection<TaskDetails> taskDetails; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the task collection. | ||
| /// </summary> | ||
| /// <value>The task collection.</value> | ||
| public ObservableCollection<TaskDetails> TaskDetails | ||
| { | ||
| ObservableCollection<TaskDetails> task = new ObservableCollection<TaskDetails>(); | ||
| task.Add( | ||
| new TaskDetails | ||
| { | ||
| TaskId = 1, | ||
| TaskName = "Scope", | ||
| StartDate = new DateTime(2011, 1, 3), | ||
| FinishDate = new DateTime(2011, 1, 14), | ||
| Progress = 40d | ||
| }); | ||
|
|
||
| task[0].Child.Add( | ||
| new TaskDetails | ||
| { | ||
| TaskId = 2, | ||
| TaskName = "Determine project office scope", | ||
| StartDate = new DateTime(2011, 1, 3), | ||
| FinishDate = new DateTime(2011, 1, 5), | ||
| Progress = 20d | ||
| }); | ||
|
|
||
| task[0].Child.Add( | ||
| new TaskDetails | ||
| { | ||
| TaskId = 3, | ||
| TaskName = "Justify project office via business model", | ||
| StartDate = new DateTime(2011, 1, 6), | ||
| FinishDate = new DateTime(2011, 1, 7), | ||
| Duration = new TimeSpan(1, 0, 0, 0), | ||
| Progress = 20d | ||
| }); | ||
|
|
||
| task[0].Child.Add( | ||
| new TaskDetails | ||
| { | ||
| TaskId = 4, | ||
| TaskName = "Secure executive sponsorship", | ||
| StartDate = new DateTime(2011, 1, 10), | ||
| FinishDate = new DateTime(2011, 1, 14), | ||
| Duration = new TimeSpan(1, 0, 0, 0), | ||
| Progress = 20d | ||
| }); | ||
|
|
||
| task[0].Child.Add( | ||
| new TaskDetails | ||
| { | ||
| TaskId = 5, | ||
| TaskName = "Secure complete", | ||
| StartDate = new DateTime(2011, 1, 14), | ||
| FinishDate = new DateTime(2011, 1, 14), | ||
| Duration = new TimeSpan(1, 0, 0, 0), | ||
| Progress = 20d | ||
| }); | ||
| get | ||
| { | ||
| return taskDetails; | ||
| } | ||
| set | ||
| { | ||
| taskDetails = value; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the task details. | ||
| /// </summary> | ||
| /// <returns></returns> | ||
| ObservableCollection<TaskDetails> GetTaskDetails() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add private method, follow code standard. |
||
| { | ||
| ObservableCollection<TaskDetails> task = new ObservableCollection<TaskDetails>(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename as |
||
| task.Add(new TaskDetails { TaskId = 1, TaskName = "Scope", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d }); | ||
| task[0].Child.Add(new TaskDetails { TaskId = 2, TaskName = "Determine project office scope", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }); | ||
| task[0].Child.Add(new TaskDetails { TaskId = 3, TaskName = "Justify Project Offfice via business model", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }); | ||
| task[0].Child.Add(new TaskDetails { TaskId = 4, TaskName = "Secure executive sponsorship", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 20d }); | ||
| task[0].Child.Add(new TaskDetails { TaskId = 5, TaskName = "Secure complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 14), Progress = 20d }); | ||
|
|
||
| task.Add(new TaskDetails { TaskId = 6, TaskName = "Risk Assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 24), Progress = 30d }); | ||
|
|
||
| task[1].Child.Add(new TaskDetails { TaskId = 7, TaskName = "Perform risk assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 21), Progress = 20d }); | ||
| task[1].Child.Add(new TaskDetails { TaskId = 8, TaskName = "Evaluate risk assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 23), Progress = 30d }); | ||
| task[1].Child.Add(new TaskDetails { TaskId = 9, TaskName = "Prepare contingency plans", StartDate = new DateTime(2011, 7, 12), FinishDate = new DateTime(2011, 7, 24), Progress = 30d }); | ||
| task[1].Child.Add(new TaskDetails { TaskId = 10, TaskName = "Risk Assessment complete", StartDate = new DateTime(2011, 7, 15), FinishDate = new DateTime(2011, 7, 24), Progress = 30d }); | ||
|
|
||
| task.Add(new TaskDetails { TaskId = 11, TaskName = "Monitoring", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 8, 6), Progress = 40d }); | ||
| task[2].Child.Add(new TaskDetails { TaskId = 12, TaskName = "Prepare Meeting agenda", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 7, 26), Progress = 30d }); | ||
| task[2].Child.Add(new TaskDetails { TaskId = 13, TaskName = "Conduct review meeting", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 7, 30), Progress = 30d }); | ||
| task[2].Child.Add(new TaskDetails { TaskId = 14, TaskName = "Migrate critical issues", StartDate = new DateTime(2011, 7, 18), FinishDate = new DateTime(2011, 8, 2), Progress = 30d }); | ||
| task[2].Child.Add(new TaskDetails { TaskId = 15, TaskName = "Estabilish change mgmt Control", StartDate = new DateTime(2011, 8, 3), FinishDate = new DateTime(2011, 8, 6), Progress = 30d }); | ||
| task[2].Child.Add(new TaskDetails { TaskId = 16, TaskName = "Monitoring Complete", StartDate = new DateTime(2011, 8, 6), FinishDate = new DateTime(2011, 8, 6), Progress = 30d }); | ||
|
|
||
| task.Add(new TaskDetails { TaskId = 17, TaskName = "Post Implementation", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 19), Progress = 40d }); | ||
| task[3].Child.Add(new TaskDetails { TaskId = 18, TaskName = "Obtain User feedback", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 10), Progress = 30d }); | ||
| task[3].Child.Add(new TaskDetails { TaskId = 19, TaskName = "Evaluate lessons learned", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 17), Progress = 30d }); | ||
| task[3].Child.Add(new TaskDetails { TaskId = 20, TaskName = "Modify items as necessary", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 19), Progress = 30d }); | ||
| task[3].Child.Add(new TaskDetails { TaskId = 21, TaskName = "Post Implementation complete", StartDate = new DateTime(2011, 8, 19), FinishDate = new DateTime(2011, 8, 19), Progress = 30d }); | ||
|
|
||
| task[0].Resources = new ObservableCollection<Resource>() { new Resource { ID = 1, Name = "John" }, new Resource { ID = 2, Name = "Neil" } }; | ||
| task[0].Child[3].Resources = new ObservableCollection<Resource>() { new Resource() { ID = 3, Name = "Peter" } }; | ||
| task[1].Resources = new ObservableCollection<Resource>() { new Resource() { ID = 4, Name = "David" } }; | ||
| return task; | ||
| } | ||
| } | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% endhighlight %} | ||
| {% endtabs %} | ||
|
|
||
| ### Adding GanttControl through designer | ||
|
|
||
|
|
@@ -234,48 +221,39 @@ The following are the steps to create Gantt control through designer. | |
| The GanttControl allows users to set the width for GanttChart and GanttGrid using the [`ChartWidth`](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_ChartWidth) and [`GridWidth`](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_GridWidth) properties. The following code sample demonstrates how to set width for chart and grid. | ||
|
|
||
| {% tabs %} | ||
|
|
||
| {% highlight xaml %} | ||
|
|
||
| <sync:GanttControl x:Name="control" GridWidth="200" ChartWidth="800" > | ||
| </Sync:GanttControl> | ||
|
|
||
| <syncfusion:GanttControl x:Name="ganttControl" | ||
| GridWidth="200" | ||
| ChartWidth="800"> | ||
| </syncfusion:GanttControl> | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% highlight c# %} | ||
|
|
||
| //Initializing Gantt | ||
| GanttControl control = new GanttControl(); | ||
| control.GridWidth = new GridLength(200); | ||
| control.ChartWidth = new GridLength(800); | ||
| this.ganttControl.GridWidth = new GridLength(200); | ||
| this.ganttControl.ChartWidth = new GridLength(800); | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% endtabs %} | ||
|
|
||
| {% endtabs %} | ||
|
|
||
| ## Schedule padding | ||
|
|
||
| Gantt schedule view can be extended by using the [`ScheduleRangePadding`](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_ScheduleRangePadding) property in GanttControl. This property extends the schedule with number of lower schedule units in starting position to improve the user experience. | ||
|
|
||
| {% tabs %} | ||
|
|
||
| {% highlight xaml %} | ||
|
|
||
| <Sync:GanttControl x:Name="control" ItemsSource="{Binding TaskCollection}" ScheduleRangePadding="5"> | ||
| </Sync:GanttControl> | ||
| <syncfusion:GanttControl x:Name="ganttControl" | ||
| ScheduleRangePadding="5"> | ||
| </syncfusion:GanttControl> | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% highlight c# %} | ||
|
|
||
| //Initializing Gantt | ||
| GanttControl control = new GanttControl(); | ||
| control.ScheduleRangePadding = 5; | ||
| this.ganttControl.ScheduleRangePadding = 5; | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% endtabs %} | ||
|
|
||
| ## ScheduleType | ||
|
|
@@ -297,52 +275,44 @@ By using the [`ScheduleType`](https://help.syncfusion.com/cr/wpf/Syncfusion.Wind | |
| The following code sample demonstrates how to set **ScheduleType** for GanttControl. | ||
|
|
||
| {% tabs %} | ||
|
|
||
| {% highlight xaml %} | ||
|
|
||
| <Sync:GanttControl x:Name="control" ItemsSource="{Binding TaskCollection}" ScheduleType="YearWithMonths" > | ||
| </Sync:GanttControl> | ||
| <syncfusion:GanttControl x:Name="ganttControl" | ||
| ScheduleType="YearWithMonths"> | ||
| </syncfusion:GanttControl> | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% highlight c# %} | ||
|
|
||
| //Initializing Gantt | ||
| GanttControl control = new GanttControl(); | ||
| control.DataContext = new ViewModel(); | ||
| control.SetBinding(GanttControl.ItemsSourceProperty,"TaskCollection"); | ||
| control.ScheduleType = ScheduleType.YearWithMonths; | ||
| this.ganttControl.ScheduleType = ScheduleType.YearWithMonths; | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% endtabs %} | ||
|
|
||
| ## Showing date with time in GanttGrid | ||
|
|
||
| To show the date with time in the GanttGrid, enable the ShowDateWithTime property as shown in the following code sample. | ||
|
|
||
| {% tabs %} | ||
|
|
||
| {% highlight xaml %} | ||
|
|
||
| <sync:GanttControl x:Name="control" ShowDateWithTime="True" ItemsSource="{Binding TaskCollection}"> | ||
| <sync:GanttControl.DataContext> | ||
| <local:ViewModel/> | ||
| </sync:GanttControl.DataContext> | ||
| </Sync:GanttControl> | ||
| <syncfusion:GanttControl x:Name="ganttControl" | ||
| ShowDateWithTime="True" | ||
| ItemsSource="{Binding TaskDetails}"> | ||
| <syncfusion:GanttControl.DataContext> | ||
| <local:ViewModel/> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add viewmodel code here. |
||
| </syncfusion:GanttControl.DataContext> | ||
| </syncfusion:GanttControl> | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% highlight c# %} | ||
|
|
||
| //Initializing Gantt | ||
| GanttControl control = new GanttControl(); | ||
| control.DataContext = new ViewModel(); | ||
| control.SetBinding(GanttControl.ItemsSourceProperty,"TaskCollection"); | ||
| control.ShowDateWithTime = true; | ||
| GanttControl ganttControl = new GanttControl(); | ||
| ganttControl.ShowDateWithTime = true; | ||
| this.ganttControl.ItemsSource = new ViewModel().TaskDetails; | ||
| this.Content = ganttControl; | ||
|
|
||
| {% endhighlight %} | ||
|
|
||
| {% endtabs %} | ||
|
|
||
| N> By default, GanttGrid will show the date alone. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,7 @@ public partial class MainWindow : Window | |
|
|
||
| The following screenshot illustrates the customized holidays sample. | ||
|
|
||
|  | ||
|  | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add border for all images. |
||
|
|
||
|
|
||
| You can download the holiday customization sample from the following link: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,9 +15,4 @@ Essential Gantt for WPF is a MS Project-like Project Viewer with built-in grid, | |
|
|
||
| Research scholars, IT companies or any organization that following work breakdown structure can use Gantt control to schedule and track their tasks/ activities. This helps tracking the progress of an assignment. By tracking the progress one can change or reschedule the plan to achieve the goal. | ||
|
|
||
|
|
||
|
|
||
|  | ||
|
|
||
|
|
||
|
|
||
|  | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add border for images
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overview images alone missing to get border so once got I will update. |
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a gap between border and images. Get proper one from UX team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a marking so gap is appearing.