wpf-devexpress-dot-xpf-dot-gantt-dot-ganttview-1fc75cfb.md
Gets or sets a path to a collection of links to resources relative to a task object. This is a dependency property.
Namespace : DevExpress.Xpf.Gantt
Assembly : DevExpress.Xpf.Gantt.v25.2.dll
NuGet Package : DevExpress.Wpf.Gantt
public string ResourceLinksPath { get; set; }
Public Property ResourceLinksPath As String
| Type | Description |
|---|---|
| String |
A path to a collection of links to resources.
|
Run Demo: Assign Resources to Tasks without Links
In the example below, gantt tasks have the ResourceIds property that contains resource IDs. Set the ResourceLinksPath property to ResourceIds to allow the GanttControl to assign resources to tasks.
<dxgn:GanttControl ItemsSource="{Binding Tasks}">
<dxgn:GanttColumn BindTo="Name" Width="Auto"/>
<dxgn:GanttColumn BindTo="ResourceLinks" AllowEditing="True"/>
<dxgn:GanttControl.View>
<dxgn:GanttView ResourcesSource="{Binding Resources}"
ResourceLinksPath="ResourceIds"
ChildNodesPath="Children"
TreeDerivationMode="ChildNodesSelector"
StartDateMapping="StartDate"
FinishDateMapping="{dxgn:Mapping FinishDate}"
NameMapping="{dxgn:Mapping Name}">
<dxgn:GanttView.ResourceMappings>
<dxgn:GanttResourceMappings Name="Name" Key="Id"/>
</dxgn:GanttView.ResourceMappings>
<dxgn:GanttView.ResourceLinkMappings>
<dxgn:GanttResourceLinkMappings Resource="."/>
</dxgn:GanttView.ResourceLinkMappings>
</dxgn:GanttView>
</dxgn:GanttControl.View>
</dxgn:GanttControl>
public class BindResourcesWithoutLinksViewModel {
public BindResourcesWithoutLinksViewModel() {
// ...
Tasks = new List<GanttDataItemWithResources> {
new GanttDataItemWithResources {
StartDate = startDate,
FinishDate = startDate + TimeSpan.FromDays(5),
Name = "Market Analysis",
ResourceIds = new List<int>() { 1 }
},
new GanttDataItemWithResources {
Name = "Feature Planning",
StartDate = startDate + TimeSpan.FromDays(5),
FinishDate = startDate + TimeSpan.FromDays(9),
ResourceIds = new List<int>() { 1, 2 }
},
new GanttDataItemWithResources {
Name = "Feature 1",
StartDate = startDate + TimeSpan.FromDays(9),
FinishDate = startDate + TimeSpan.FromDays(16),
Children = new[] {
new GanttDataItemWithResources {
Name = "Implementation",
StartDate = startDate + TimeSpan.FromDays(9),
FinishDate = startDate + TimeSpan.FromDays(13),
ResourceIds = new List<int>() { 2 }
},
new GanttDataItemWithResources {
Name = "Demos & Docs",
StartDate = startDate + TimeSpan.FromDays(13),
FinishDate = startDate + TimeSpan.FromDays(16),
ResourceIds = new List<int>() { 4, 2 }
}
},
},
// ...
};
Resources = new List<GanttResourceItem> {
new GanttResourceItem { Name = "Management", Id = 1 },
new GanttResourceItem { Name = "Developers", Id = 2 },
new GanttResourceItem { Name = "Testers", Id = 3 },
new GanttResourceItem { Name = "Technical Writers", Id = 4 }
};
}
public IEnumerable<GanttDataItemWithResources> Tasks { get; private set; }
public IEnumerable<GanttResourceItem> Resources { get; private set; }
}
public class GanttDataItemWithResources : GanttDataItem {
public List<int> ResourceIds { get; set; }
}
public class GanttResourceItem {
public string Name { get; set; }
public int Id { get; set; }
}
Public Class BindResourcesWithoutLinksViewModel
Public Sub New()
' ...
Tasks = New List(Of GanttDataItemWithResources) From {
New GanttDataItemWithResources With {
.StartDate = startDate,
.FinishDate = startDate + TimeSpan.FromDays(5),
.Name = "Market Analysis",
.ResourceIds = New List(Of Integer)() From { 1 }
},
New GanttDataItemWithResources With {
.Name = "Feature Planning",
.StartDate = startDate + TimeSpan.FromDays(5),
.FinishDate = startDate + TimeSpan.FromDays(9),
.ResourceIds = New List(Of Integer)() From { 1, 2 }
},
New GanttDataItemWithResources With {
.Name = "Feature 1",
.StartDate = startDate + TimeSpan.FromDays(9),
.FinishDate = startDate + TimeSpan.FromDays(16),
.Children = {New GanttDataItemWithResources With {
.Name = "Implementation",
.StartDate = startDate + TimeSpan.FromDays(9),
.FinishDate = startDate + TimeSpan.FromDays(13),
.ResourceIds = New List(Of Integer)() From { 2 }
}, New GanttDataItemWithResources With {
.Name = "Demos & Docs",
.StartDate = startDate + TimeSpan.FromDays(13),
.FinishDate = startDate + TimeSpan.FromDays(16),
.ResourceIds = New List(Of Integer)() From { 4, 2 }
}}
' ...
}
}
Resources = New List(Of GanttResourceItem) From {
New GanttResourceItem With { .Name = "Management", .Id = 1 },
New GanttResourceItem With { .Name = "Developers", .Id = 2 },
New GanttResourceItem With { .Name = "Testers", .Id = 3 },
New GanttResourceItem With { .Name = "Technical Writers", .Id = 4 }
}
End Sub
Public Property Tasks As IEnumerable(Of GanttDataItemWithResources)
Public Property Resources As IEnumerable(Of GanttResourceItem)
End Class
Public Class GanttDataItemWithResources
Inherits GanttDataItem
Public Property ResourceIds As List(Of Integer)
End Class
Public Class GanttResourceItem
Public Property Name As String
Public Property Id As Integer
End Class
See Also