HypernovaDesktop Components · docs
Binarymission
WinForms › Project Management › LinksChangingEventArgs

LinksChangingEventArgs

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.ProjectManagement

Provides data for the Gantt chart's GanttChart.LinksChanging event: links the reader is about to add to the plan or remove from it, all leading into one task.

public class LinksChangingEventArgs : CancelEventArgs

Inherits from / implements: CancelEventArgs

Remarks

Drawing a link from one bar to another adds one finish-to-start link. Typing into a task's Predecessors cell replaces the links into the task with the ones typed; a link typed exactly as it already is stays, with its Id, so only the differences are listed – new links in Added, dropped ones in Removed. (The Windows Forms chart also removes a selected link with Delete.)

Set CancelEventArgs.Cancel to true to refuse the whole change. Otherwise Removed are removed from the chart's Links collection and Added are added to it.

Examples

gantt.LinksChanging += (sender, e) =>
{
    // Give each new link an id from the application's own sequence before it is stored.
    foreach (TaskLink link in e.Added)
    {
        link.Id = "L" + (++lastLinkNumber).ToString();
    }
};

Members at a glance

Constructors
LinksChangingEventArgsCreates the data for a proposed change to the links into a task.
Properties
AddedGets the new link objects that would be added to the links collection.
RemovedGets the links, from the links collection, that would be removed from it.
SourceGets how the change was made.
TaskIdGets the id of the task whose incoming links change: the successor of every link in Added and Removed.

Constructors

LinksChangingEventArgs

public LinksChangingEventArgs(string taskId, TaskEditSource source, IReadOnlyList<TaskLink> added, IReadOnlyList<TaskLink> removed)

Creates the data for a proposed change to the links into a task.

Parameters
taskId
The id of the task whose incoming links change.
source
How the change was made.
added
Links that would be added; null for none.
removed
Links that would be removed; null for none.

Properties

Added

public IReadOnlyList<TaskLink> Added

Gets the new link objects that would be added to the links collection.

Value
Never null; empty when nothing is added. The objects can be changed before they are stored – given an id, say.

Removed

public IReadOnlyList<TaskLink> Removed

Gets the links, from the links collection, that would be removed from it.

Value
Never null; empty when nothing is removed.

Source

public TaskEditSource Source

Gets how the change was made.

TaskId

public string TaskId

Gets the id of the task whose incoming links change: the successor of every link in Added and Removed.