GanttView
Namespace: Wisej.Web
Assembly: Wisej.Framework (4.2.0.0)
Displays a project task hierarchy with editable dates, completion, dependencies and a working calendar.
- C#
- VB.NET
public class GanttView : Control
Public Class GanttView
Inherits Control
Dates use calendar dates rather than time zones. End is exclusive. Dragging preserves working-day duration; resizing changes scope. Predecessors constrain start dates. Pointer movement stays local; TaskMoving is raised at drop, followed by a completion event only when accepted. Bound records must expose writable mapped properties for edits. Summary rows do not aggregate dates automatically.
Example:
var gantt = new GanttView { Dock = DockStyle.Fill, AllowDrag = true, AllowResize = true };
gantt.Tasks.Add(new GanttTask { Id = "design", Text = "Design", Start = DateTime.Today, End = DateTime.Today.AddDays(5) });
gantt.TaskMoving += (sender, e) => e.Cancel = e.Start < DateTime.Today;
Controls.Add(gantt);
Constructors
GanttView()
Creates an empty weekly project timeline.
Properties
AllowDrag
Boolean: Gets or sets whether users may move task bars. (Default: True)
AllowLink
Boolean: Gets or sets whether users may drag finish-to-start dependency links. (Default: True)
AllowResize
Boolean: Gets or sets whether users may drag bar endpoints or completion handles. (Default: True)
CriticalPath
Boolean: Gets or sets whether zero-slack tasks are highlighted. (Default: False)
DataSource
Object: Gets or sets an IEnumerable or IListSource. IBindingList changes refresh task projections. (Default: null)
DependsOnMember
String: Gets or sets the bound member used for DependsOn. Empty optional mappings use defaults. (Default: "DependsOn")
EndMember
String: Gets or sets the bound member used for End. Empty optional mappings use defaults. (Default: "End")
IdMember
String: Gets or sets the bound member used for Id. Empty optional mappings use defaults. (Default: "Id")
MilestoneMember
String: Gets or sets the bound member used for Milestone. Empty optional mappings use defaults. (Default: "Milestone")
MilestoneText
String: Gets or sets the localized override for the "milestone" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.
NoTasksText
String: Gets or sets the localized override for the "No project tasks" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.
ParentIdMember
String: Gets or sets the bound member used for ParentId. Empty optional mappings use defaults. (Default: "ParentId")
ProgressMember
String: Gets or sets the bound member used for Progress. Empty optional mappings use defaults. (Default: "Progress")
ShowProgress
Boolean: Gets or sets whether completion fills and drag handles are visible. (Default: True)
ShowToday
Boolean: Gets or sets whether the current date marker is visible. (Default: True)
StartMember
String: Gets or sets the bound member used for Start. Empty optional mappings use defaults. (Default: "Start")
TaskHeaderText
String: Gets or sets the localized override for the "TASK" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.
TaskListWidth
Int32: Gets or sets the task-list width in pixels. (Default: 260)
Tasks
GanttTaskCollection: Gets the owned tasks. Assigning DataSource replaces these with bound projections.
TextMember
String: Gets or sets the bound member used for Text. Empty optional mappings use defaults. (Default: "Text")
TimeScale
GanttTimeScale: Gets or sets the timeline header scale. (Default: Weeks)
TodayText
String: Gets or sets the localized override for the "TODAY" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.
ToneMember
String: Gets or sets the bound member used for Tone. Empty optional mappings use defaults. (Default: "Tone")
WeekNumberText
String: Gets or sets the localized override for the "W{0}" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation. {0} is the week number. Literal braces can be written as {{ and }}.
WorkCalendar
GanttWorkCalendar: Gets the working calendar used by dragging, background shading and critical-path duration.
Methods
AddDependency(predecessor, successor)
Proposes a finish-to-start link, rejecting duplicate links, cycles and a successor beginning before its predecessor ends.
| Parameter | Type | Description |
|---|---|---|
| predecessor | GanttTask | The predecessor passed to the operation. |
| successor | GanttTask | The successor passed to the operation. |
Returns: Boolean.
Dispose(disposing)
Releases binding and model event subscriptions.
| Parameter | Type | Description |
|---|---|---|
| disposing | Boolean | true to release managed and unmanaged resources; false to release only unmanaged resources. |
ExpandAll()
Expands every hierarchy branch.
GetCriticalTaskIds()
Returns zero-slack task identities using a duration-based finish-to-start critical path. Explicit gaps in scheduled dates are not constraints.
Returns: String[].
OnDependencyCreated(e)
Raises DependencyCreated for subscribers and derived controls.
| Parameter | Type | Description |
|---|---|---|
| e | GanttDependencyEventArgs | The event data. |
OnProgressChanged(e)
Raises ProgressChanged for subscribers and derived controls.
| Parameter | Type | Description |
|---|---|---|
| e | GanttTaskChangeEventArgs | The event data. |
OnTaskClick(e)
Raises TaskClick for subscribers and derived controls.
| Parameter | Type | Description |
|---|---|---|
| e | GanttTaskEventArgs | The event data. |
OnTaskDoubleClick(e)
Raises TaskDoubleClick for subscribers and derived controls.
| Parameter | Type | Description |
|---|---|---|
| e | GanttTaskEventArgs | The event data. |
OnTaskMoved(e)
Raises TaskMoved for subscribers and derived controls.
| Parameter | Type | Description |
|---|---|---|
| e | GanttTaskChangeEventArgs | The event data. |
OnTaskMoving(e)
Raises TaskMoving for subscribers and derived controls.
| Parameter | Type | Description |
|---|---|---|
| e | GanttTaskChangeEventArgs | The event data. |
OnTaskResized(e)
Raises TaskResized for subscribers and derived controls.
| Parameter | Type | Description |
|---|---|---|
| e | GanttTaskChangeEventArgs | The event data. |
OnWebEvent(e)
Dispatches client requests to validated processors.
| Parameter | Type | Description |
|---|---|---|
| e | WisejEventArgs | The event data. |
OnWebRender(config)
Renders independent widget properties and a revisioned task snapshot.
| Parameter | Type | Description |
|---|---|---|
| config | Object | The config passed to the operation. |
RefreshData()
Rebuilds bound task projections. Task ids must be unique; use IdMember for stable identities.
RescheduleTask(task, start, end, resize)
Proposes new dates atomically. A move preserves working duration and shifts off non-working starts; resize preserves the requested exclusive end.
| Parameter | Type | Description |
|---|---|---|
| task | GanttTask | The task passed to the operation. |
| start | DateTime | The start passed to the operation. |
| end | DateTime | The end passed to the operation. |
| resize | Boolean | The resize passed to the operation. The default is false. |
Returns: Boolean.
ScrollTo(date)
Scrolls the timeline to a calendar date.
| Parameter | Type | Description |
|---|---|---|
| date | DateTime | The date passed to the operation. |
SetExpanded(task, expanded)
Expands or collapses a task branch without changing task ownership.
| Parameter | Type | Description |
|---|---|---|
| task | GanttTask | The task passed to the operation. |
| expanded | Boolean | The expanded passed to the operation. |
SetTaskProgress(task, progress)
Proposes a completion percentage between zero and 100.
| Parameter | Type | Description |
|---|---|---|
| task | GanttTask | The task passed to the operation. |
| progress | Double | The progress passed to the operation. |
Returns: Boolean.
Events
DependencyCreated
EventHandler<GanttDependencyEventArgs> Occurs before a valid dependency is committed; Cancel rejects the link.
ProgressChanged
EventHandler<GanttTaskChangeEventArgs> Occurs after an accepted completion change. Cancellation belongs to TaskMoving.
TaskClick
EventHandler<GanttTaskEventArgs> Occurs when a task is activated.
TaskDoubleClick
EventHandler<GanttTaskEventArgs> Occurs when a task is double-clicked.
TaskMoved
EventHandler<GanttTaskChangeEventArgs> Occurs after an accepted move. Cancellation belongs to TaskMoving.
TaskMoving
EventHandler<GanttTaskChangeEventArgs> Occurs at drop before Move, Resize or Progress is committed; Cancel rejects the edit.
TaskResized
EventHandler<GanttTaskChangeEventArgs> Occurs after an accepted resize. Cancellation belongs to TaskMoving.
Implements
| Name | Description |
|---|---|
| IUserData | Provides access to the UserData and Tag properties associated to the component implementing this interface. |
| IBindableComponent | Bindable components implement this interface. |
| IDropTarget | Controls that support drag & drop operations implement this interface. |
| IWisejComponent | All wisej components implement this interface. |
| IWisejControl | All wisej controls derived from the Control class must implement this interface. |
| IWisejSerializable | Allows an object to serialize itself. |