Skip to main content

ContentDetailDescriptor Class

Represents a Detail with freely-customizable content.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public class ContentDetailDescriptor :
    DetailDescriptorBase

Remarks

When setting up master-detail hierarchy, the Detail may display either another grid or custom controls. If you choose to display custom controls, you will need to use the ContentDetailDescriptor object in one of the following ways:

The following are the main members in the ContentDetailDescriptor class that you will need to work with:

Member Description
DetailDescriptorBase.ContentTemplate Gets or sets the template specifying the entire or partial content of a Detail.
ContentDetailDescriptor.HeaderContent Gets or sets the detail section’s header content. This is a dependency property.

Example

This example displays the memo field and the Chart Control in grid details. The memo field displays data from the master row, and the chart is bound to detail data. The DataTemplate that contains these two controls is asigned to both ContentDetailDescriptor and DataControlDetailDescriptor:

  • The ContentDetailDescriptor tab displays the custom content only.
  • The DataControlDetailDescriptor tab displays the custom content above the detail GridControl.

WPF Data Grid - Display Chart Control in Grid Details

View Example: Display Chart Control in Grid Details

<Window
    x:Class="WpfApplication19.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
    Title="MainWindow" Height="450" Width="800">
    <!--region #ContentTemplate-->
    <Window.Resources>
        <DataTemplate x:Key="ContentDetail">
            <Grid Margin="10,10,10,10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Vertical" Grid.Column="0">
                    <TextBlock Text="Notes:" FontWeight="Bold"/>
                    <TextBlock Text="{Binding Path=Notes}" TextWrapping="Wrap"/>
                </StackPanel>
                <dxc:ChartControl DataSource="{Binding Path=Orders}" Grid.Column="1" Height="200" Margin="10,10,10,10">
                    <dxc:SimpleDiagram2D>
                        <dxc:SimpleDiagram2D.Series>
                            <dxc:PieSeries2D ArgumentDataMember="Supplier" ValueDataMember="Quantity" LabelsVisibility="True">
                                <dxc:PieSeries2D.PointOptions>
                                    <dxc:PointOptions>
                                        <dxc:PointOptions.ValueNumericOptions>
                                            <dxc:NumericOptions Format="Percent" Precision="0"/>
                                        </dxc:PointOptions.ValueNumericOptions>
                                    </dxc:PointOptions>
                                </dxc:PieSeries2D.PointOptions>
                                <dxc:PieSeries2D.LegendPointOptions>
                                    <dxc:PointOptions Pattern="{}{A}"/>
                                </dxc:PieSeries2D.LegendPointOptions>
                            </dxc:PieSeries2D>
                        </dxc:SimpleDiagram2D.Series>
                    </dxc:SimpleDiagram2D>
                    <dxc:ChartControl.Legend>
                        <dxc:Legend Visibility="Visible"/>
                    </dxc:ChartControl.Legend>
                </dxc:ChartControl>
            </Grid>
        </DataTemplate>
    </Window.Resources>
    <!--endregion #ContentTemplate-->

    <Grid>
        <dxg:GridControl x:Name="grid" AutoGenerateColumns="AddNew">
            <dxg:GridControl.View>
                <dxg:TableView AutoWidth="True" ShowGroupPanel="False"/>
            </dxg:GridControl.View>
            <dxg:GridControl.DetailDescriptor>
                <dxg:TabViewDetailDescriptor>
                    <dxg:ContentDetailDescriptor ContentTemplate="{StaticResource ContentDetail}" HeaderContent="ContentDetailDescriptor"/>
                    <dxg:DataControlDetailDescriptor ContentTemplate="{StaticResource ContentDetail}" ItemsSourcePath="Orders">
                        <dxg:GridControl AutoGenerateColumns="AddNew">
                            <dxg:GridControl.View>
                                <dxg:TableView AutoWidth="True" DetailHeaderContent="DataControlDetailDescriptor" ShowGroupPanel="False" />
                            </dxg:GridControl.View>
                        </dxg:GridControl>
                    </dxg:DataControlDetailDescriptor>
                </dxg:TabViewDetailDescriptor>
            </dxg:GridControl.DetailDescriptor>
        </dxg:GridControl>
    </Grid>
</Window>

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

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.

See Also