Skip to main content

GanttControlNode.GetSuccessors() Method

Returns keys (see KeyFieldName) of the node’s successors. This method is only in effect if you use the DependencySource property to specify dependencies.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v24.1.dll

NuGet Package: DevExpress.Win.Gantt

Declaration

public object GetSuccessors()

Returns

Type Description
Object

An object that specifies keys of the task’s successors.

Remarks

Use the methods below to obtain a task’s successors. You can use a GanttControlNode object or Id property value to specify the task.

Use the methods below to obtain a task’s predecessors. You can use a GanttControlNode object or Id property value to specify the task.

Example

The example below shows how to get a task’s predecessors and successors. You can use the FindNodeByFieldValue(String, Object) method to retrieve a GanttControlNode object by the content in a specific field.

using DevExpress.XtraGantt;
using System.Collections.Generic;

// The following methods return nodes that specify a task's predecessors and successors.
IEnumerable<GanttControlNode> predecessorNodes = 
    ganttControl1.GetPredecessorNodes(0);
IEnumerable<GanttControlNode> predecessorNodes1 = 
    ganttControl1.GetPredecessorNodes(ganttControl1.FindNodeByFieldValue("Text", "Task 2") as GanttControlNode);
IEnumerable<GanttControlNode> predecessorNodes2 = 
    (ganttControl1.FindNodeByFieldValue("Text", "Task 3") as GanttControlNode).GetPredecessorNodes();

IEnumerable<GanttControlNode> successorNodes = 
    ganttControl1.GetSuccessorNodes(0);
IEnumerable<GanttControlNode> successorNodes1 = 
    ganttControl1.GetSuccessorNodes(ganttControl1.FindNodeByFieldValue("Text", "Task 2") as GanttControlNode);
IEnumerable<GanttControlNode> successorNodes2 = 
    (ganttControl1.FindNodeByFieldValue("Text", "Task 3") as GanttControlNode).GetSuccessorNodes();

// The following methods return keys
// (as they are specified in the data source) of a task's predecessors and successors.
// If you use the DependencySource property to specify dependencies,
// the returned value is of List<object> type. Items in the collection are keys of the corresponding type.
List<object> predecessorKeyList = 
    ganttControl1.GetPredecessors(0) as List<object>;
List<object> predecessorsKeyList1 = 
    ganttControl1.GetPredecessors(ganttControl1.FindNodeByFieldValue("Text", "Task 2") as GanttControlNode) as List<object>;
List<object> predecessorsKeyList2 = 
    (ganttControl1.FindNodeByFieldValue("Text", "Task 3") as GanttControlNode).GetPredecessors() as List<object>;

List<object> successorKeyList = 
    ganttControl1.GetSuccessors(0) as List<object>;
List<object> successorsKeyList1 = 
    ganttControl1.GetSuccessors(ganttControl1.FindNodeByFieldValue("Text", "Task 2") as GanttControlNode) as List<object>;
List<object> successorsKeyList2 = 
    (ganttControl1.FindNodeByFieldValue("Text", "Task 3") as GanttControlNode).GetSuccessors() as List<object>;

// If you use the DataSource property to specify dependencies,
// the returned value is of the same type as in the data source.
// Note that you cannot get successors in this case
// since the data source stores predecessors only.
var predecessorKeys = 
    ganttControl1.GetPredecessors(0);
var predecessorsKeys1 = 
    ganttControl1.GetPredecessors(ganttControl1.FindNodeByFieldValue("Text", "Task 2") as GanttControlNode);
var predecessorsKeys2 = 
    (ganttControl1.FindNodeByFieldValue("Text", "Task 3") as GanttControlNode).GetPredecessors();
See Also