Back to Devexpress

GridControl.DetailDescriptor Property

wpf-devexpress-dot-xpf-dot-grid-dot-gridcontrol-136ff534.md

latest7.9 KB
Original Source

GridControl.DetailDescriptor Property

Enables master-detail representation within this GridControl.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public DetailDescriptorBase DetailDescriptor { get; set; }
vb
Public Property DetailDescriptor As DetailDescriptorBase

Property Value

TypeDescription
DetailDescriptorBase

A DetailDescriptorBase descendant specifying which details to display for this GridControl.

|

Remarks

This property is crucial to setting up the master-detail hierarchy within the GridControl. You need to initialize it with a proper DetailDescriptorBase descendant as outlined in the following table.

Detail DescriptorPurpose
DataControlDetailDescriptorUse this object to display another GridControl or any DataControlBase descendant within the Detail View. When using a GridControl, Detail View synchronization and Master View integration become avialable.
ContentDetailDescriptorUse this object to display any set of controls within the Detail View. You can also use it to display a GridControl if you don’t want Detail View synchronization or Master View Integration features that become enabled when using the DataControlDetailDescriptor.
TabViewDetailDescriptorUse this object to display multiple details within a tabbed container.

Refer to the following help topic for more information: Master-Detail Data Representation.

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 DetailDescriptor 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-detail-content-in-tabs/CS/WpfApplication18/MainWindow.xaml#L16

xml
</dxg:GridControl.View>
<dxg:GridControl.DetailDescriptor>
    <dxg:TabViewDetailDescriptor>

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

xml
</dxg:GridControl.View>
<dxg:GridControl.DetailDescriptor>
    <dxg:TabViewDetailDescriptor>

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

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

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

xml
</dxg:GridControl.View>
<dxg:GridControl.DetailDescriptor>
    <dxg:ContentDetailDescriptor>

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

xml
<dxg:GridControl AutoGenerateColumns="AddNew" ItemsSource="{Binding Tasks}">
    <dxg:GridControl.DetailDescriptor>
        <dxg:DetailDescriptorSelector>

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

csharp
gridControl.DetailDescriptor = tabDetail;
}

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

vb
tabDetail.DetailDescriptors.Add(chartDetail)
    gridControl.DetailDescriptor = tabDetail
End Sub

See Also

GridControl Class

GridControl Members

DevExpress.Xpf.Grid Namespace