Back to Devexpress

GanttDependencyMappings.TypeFieldName Property

windowsforms-devexpress-dot-xtragantt-dot-ganttdependencymappings-083b1e06.md

latest3.8 KB
Original Source

GanttDependencyMappings.TypeFieldName Property

Gets or sets the data source field (of the DependencyType or Int32 type) that specifies a task’s dependency type.

Namespace : DevExpress.XtraGantt

Assembly : DevExpress.XtraGantt.v25.2.dll

NuGet Package : DevExpress.Win.Gantt

Declaration

csharp
[DefaultValue("Type")]
[DXCategory("Mappings")]
[XtraSerializableProperty]
public string TypeFieldName { get; set; }
vb
<DXCategory("Mappings")>
<DefaultValue("Type")>
<XtraSerializableProperty>
Public Property TypeFieldName As String

Property Value

TypeDefaultDescription
String"Type"

The data source field that specifies a task’s dependency type.

|

Remarks

The GanttControl.DependencySource property specifies the data source that contains dependencies. Use the TypeFieldName property to specify the name of the field in the data source that stores dependency types.

The field’s data type should be either DependencyType or Int32. The DependencyType enumeration is a set of named integer constants. You can store dependency types as integers in the data source.

Example

The code below uses integer values to specify dependency types.

csharp
using DevExpress.XtraGantt;
using System.Data;

ganttControl1.DependencySource = GetDependencies();

private object GetDependencies() {
    DataTable table = new DataTable();
    DataColumn predecessor = new DataColumn("PredecessorID", typeof(int));
    DataColumn successor = new DataColumn("SuccessorID", typeof(int));
    DataColumn dependencyType = new DataColumn("DependencyType", typeof(DependencyType));
    DataColumn lag = new DataColumn("TimeLag", typeof(TimeSpan));
    table.Columns.AddRange(new DataColumn[] { predecessor, successor, dependencyType, lag });
    //Note that an integer value is used to specify the dependency type.
    table.Rows.Add(new object[] { 1, 2, 2, new TimeSpan(12, 0, 0) });
    table.Rows.Add(new object[] { 2, 3, 3, null });
    return table;
}
vb
Imports DevExpress.XtraGantt
Imports System.Data

ganttControl1.DependencySource = GetDependencies()

Private Function GetDependencies() As Object
    Dim table As DataTable = New DataTable()
    Dim predecessor As DataColumn = New DataColumn("PredecessorID", GetType(Integer))
    Dim successor As DataColumn = New DataColumn("SuccessorID", GetType(Integer))
    Dim dependencyType As DataColumn = New DataColumn("DependencyType", GetType(DependencyType))
    Dim lag As DataColumn = New DataColumn("TimeLag", GetType(TimeSpan))
    table.Columns.AddRange(New DataColumn() {predecessor, successor, dependencyType, lag})
    'Note that an integer value is used to specify the dependency type.
    table.Rows.Add(New Object() {1, 2, 2, New TimeSpan(12, 0, 0)})
    table.Rows.Add(New Object() {2, 3, 3, Nothing})
    Return table
End Function

See Also

GanttDependencyMappings Class

GanttDependencyMappings Members

DevExpress.XtraGantt Namespace