GanttView.ResourceLinksPath Property
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.v24.1.dll
NuGet Package: DevExpress.Wpf.Gantt
Declaration
Property Value
Type | Description |
---|---|
String | A path to a collection of links to resources. |
Remarks
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; }
}
See Also