Back to Devexpress

GanttChartMappings.TextFieldName Property

windowsforms-devexpress-dot-xtragantt-dot-ganttchartmappings.md

latest5.8 KB
Original Source

GanttChartMappings.TextFieldName Property

Gets or sets the data source field (of the String type) that contains the caption displayed next to a task in the chart area.

Namespace : DevExpress.XtraGantt

Assembly : DevExpress.XtraGantt.v25.2.dll

NuGet Package : DevExpress.Win.Gantt

Declaration

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

Property Value

TypeDefaultDescription
StringString.Empty

The data source field that contains a task’s caption.

|

Remarks

The GanttControl.ChartMappings property provides access to data fields mapped to task properties that specify how a task is displayed in the chart area. The TextFieldName property specifies the data field that contains task captions.

The caption is displayed next to the task in the chart area. To obtain a task’s caption in code, you can use the GetText(GanttControlNode), GetText(Int32), and GetText() methods.

You can also handle the CustomTaskDisplayText event, which fires before a task is displayed, to specify a caption dynamically.

A task’s caption can also be displayed in interaction tooltips. You can use the InteractionTooltipTextFieldName property to specify the data field that contains task captions for tooltips. To obtain a task’s tooltip caption in code, use the GetTooltipText(Int32) method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the TextFieldName property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

xaf-win-gantt-control/CS/XPO/GanttSolutionXPO/GanttSolutionXPO.Win/Editors/CustomGanttEditor.cs#L79

csharp
control.ParentFieldName = nameof(IMyTask.Parent);
control.ChartMappings.TextFieldName = nameof(IMyTask.Name);
control.ChartMappings.StartDateFieldName = nameof(IMyTask.StartDate);

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/GanttItem/GanttItemControlProvider.cs#L97

csharp
gantt.Columns.Clear();
gantt.TreeListMappings.KeyFieldName = gantt.TreeListMappings.ParentFieldName = gantt.ChartMappings.TextFieldName
    = gantt.ChartMappings.StartDateFieldName = gantt.ChartMappings.FinishDateFieldName = string.Empty;

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/GanttItem/GanttItemControlProvider.vb#L94

vb
gantt.ChartMappings.StartDateFieldName = gantt.ChartMappings.FinishDateFieldName
gantt.ChartMappings.TextFieldName = gantt.ChartMappings.StartDateFieldName
gantt.TreeListMappings.ParentFieldName = gantt.ChartMappings.TextFieldName

See Also

Tasks, Summaries, and Milestones

Obtaining and Setting Cell Values

GetText(GanttControlNode)

GetText(Int32)

GetName(GanttControlNode)

GetText()

CustomTaskDisplayText

InteractionTooltipTextFieldName

GanttChartMappings Class

GanttChartMappings Members

DevExpress.XtraGantt Namespace