Back to Devexpress

DataControlDetailDescriptor.ItemsSourcePath Property

wpf-devexpress-dot-xpf-dot-grid-dot-datacontroldetaildescriptor-5c40bf2d.md

latest8.5 KB
Original Source

DataControlDetailDescriptor.ItemsSourcePath Property

Gets or sets the detail grid’s data binding by specifying the path relative to the master grid’s records.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public string ItemsSourcePath { get; set; }
vb
Public Property ItemsSourcePath As String

Property Value

TypeDescription
String

A string value specifying the data binding path relative to the master grid’s records.

|

Remarks

When working with an Entity Framework source, this property value should be set to the name of the Navigation Property that represents the required data relation. Similarly, when working with master-detail data created in code, the ItemsSourcePath property is set to the name of the property that references the aggregated collection.

You can use ItemsSourcePath in combination with the DataControlDetailDescriptor.ItemsSourceValueConverter property. If these two properties are insufficient for your data binding scenario, use the DataControlDetailDescriptor.ItemsSourceBinding property.

Example

This example creates tabbed details (TabViewDetailDescriptor) in the GridControl. The Orders tab displays the GridControl (DataControlDetailDescriptor), and the Notes tab displays a memo field (ContentDetailDescriptor).

View Example: Display Detail Content in Tabs

xaml
<Window.Resources>
    <DataTemplate x:Key="EmployeeNotes">
        <TextBlock Text="{Binding Path=Notes}" TextWrapping="Wrap" Padding="4"/>
    </DataTemplate>
</Window.Resources>
<Grid>
    <dxg:GridControl x:Name="grid" AutoGenerateColumns="AddNew">
        <dxg:GridControl.View>
            <dxg:TableView DetailHeaderContent="Employees" AutoWidth="True" ShowGroupPanel="False"/>
        </dxg:GridControl.View>
        <dxg:GridControl.DetailDescriptor>
            <dxg:TabViewDetailDescriptor>
                <dxg:DataControlDetailDescriptor ItemsSourcePath="Orders">
                    <dxg:DataControlDetailDescriptor.DataControl>
                        <dxg:GridControl AutoGenerateColumns="AddNew">
                            <dxg:GridControl.View>
                                <dxg:TableView DetailHeaderContent="Orders" AutoWidth="True" ShowGroupPanel="False"/>
                            </dxg:GridControl.View>
                        </dxg:GridControl>
                    </dxg:DataControlDetailDescriptor.DataControl>
                </dxg:DataControlDetailDescriptor>
                <dxg:ContentDetailDescriptor ContentTemplate="{StaticResource EmployeeNotes}" HeaderContent="Notes"/>
            </dxg:TabViewDetailDescriptor>
        </dxg:GridControl.DetailDescriptor>
    </dxg:GridControl>
</Grid>

The following code snippets (auto-collected from DevExpress Examples) contain references to the ItemsSourcePath 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.

wpf-data-grid-display-different-details-based-on-master-row-data/CS/WpfApp30/MainWindow.xaml#L19

xml
<dxg:DetailDescriptorSelector.DefaultValue>
    <dxg:DataControlDetailDescriptor ItemsSourcePath="CompletedActions">
        <dxg:GridControl AutoGenerateColumns="AddNew">

wpf-data-grid-display-detail-content-in-tabs/CS/WpfApplication18/MainWindow.xaml#L18

xml
<dxg:TabViewDetailDescriptor>
    <dxg:DataControlDetailDescriptor ItemsSourcePath="Orders">
        <dxg:DataControlDetailDescriptor.DataControl>

wpf-data-grid-display-chart-control-in-grid-details/CS/WpfApplication19/MainWindow.xaml#L54

xml
<dxg:ContentDetailDescriptor ContentTemplate="{StaticResource ContentDetail}" HeaderContent="ContentDetailDescriptor"/>
<dxg:DataControlDetailDescriptor ContentTemplate="{StaticResource ContentDetail}" ItemsSourcePath="Orders">
    <dxg:GridControl AutoGenerateColumns="AddNew">

wpf-data-grid-expand-and-collapse-master-rows/CS/WpfApplication21/MainWindow.xaml#L17

xml
<dxg:GridControl.DetailDescriptor>
    <dxg:DataControlDetailDescriptor ItemsSourcePath="Orders">
        <dxg:DataControlDetailDescriptor.DataControl>

wpf-data-grid-display-custom-content-in-grid-details/CS/WpfApplication18/MainWindow.xaml.cs#L56

csharp
DataControlDetailDescriptor dataControlDetail = new DataControlDetailDescriptor();
dataControlDetail.ItemsSourcePath = "Orders";

wpf-data-grid-create-master-detail-grid-in-code/CS/MasterDetailInCode/MainWindow.xaml.cs#L34

csharp
DataControlDetailDescriptor gridDetail = new DataControlDetailDescriptor();
gridDetail.ItemsSourcePath = nameof(Employee.Orders);
gridDetail.DataControl = detailGridControl;

wpf-data-grid-display-custom-content-in-grid-details/VB/WpfApplication18/MainWindow.xaml.vb#L51

vb
Dim dataControlDetail As New DataControlDetailDescriptor()
dataControlDetail.ItemsSourcePath = "Orders"

wpf-data-grid-create-master-detail-grid-in-code/VB/MasterDetailInCode/MainWindow.xaml.vb#L36

vb
Dim gridDetail As DataControlDetailDescriptor = New DataControlDetailDescriptor()
gridDetail.ItemsSourcePath = NameOf(Employee.Orders)
gridDetail.DataControl = detailGridControl

See Also

DataControl

ItemsSourceBinding

ItemsSourceValueConverter

DataControlDetailDescriptor Class

DataControlDetailDescriptor Members

DevExpress.Xpf.Grid Namespace