Skip to main content
A newer version of this page is available. .

ContentDetailDescriptor Class

Represents a Detail with freely-customizable content.

Namespace: DevExpress.Xpf.Grid

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Grid.Core, 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.

This example shows how to setup a GridControl detail with a memo field. Thus, you will see ContentDetailDescriptor objects in action.

The form first displays one grid that has been set up via XAML code. There’s also a button that created a second identical grid in code, so you can learn both ways to add details to the grid.

View Example

<Window xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"  x:Class="WpfApplication18.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="768" Width="1024" xmlns:my="clr-namespace:WpfApplication18" Loaded="Window_Loaded">
    <Window.Resources>
        <!--<DataTemplate x:Key="EmployeeNotes">
            <Border>
                <TextBlock Text="{Binding Path=Notes}" TextWrapping="Wrap" ></TextBlock>
            </Border>
        </DataTemplate>-->
    </Window.Resources>
    <Grid x:Name="mainGrid">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="32"/>
        </Grid.RowDefinitions>
        <!--region #GridDesignTime-->
        <dxg:GridControl Grid.Row="0" Name="gridControl1" AutoGenerateColumns="AddNew" >
            <dxg:GridControl.View>
                <dxg:TableView DetailHeaderContent="Employees" AutoWidth="True" ShowGroupPanel="False"  />
            </dxg:GridControl.View>
            <dxg:GridControl.DetailDescriptor>
                <dxg:ContentDetailDescriptor  HeaderContent="Notes">
                    <dxg:ContentDetailDescriptor.ContentTemplate>
                        <DataTemplate >
                            <Border>
                                <TextBlock Text="{Binding Path=Notes}" TextWrapping="Wrap" ></TextBlock>
                            </Border>
                        </DataTemplate>
                    </dxg:ContentDetailDescriptor.ContentTemplate>
                </dxg:ContentDetailDescriptor>
            </dxg:GridControl.DetailDescriptor>
        </dxg:GridControl>
        <!--endregion #GridDesignTime-->

        <Button Grid.Row="3" Click="Button_Click">
            <TextBlock Text="Create Second Grid in Code"></TextBlock>
        </Button>
        <GridSplitter Grid.Row="1" Height="10" Name="gridSplitter1" VerticalAlignment="Center" Width="Auto" ResizeDirection="Rows" HorizontalAlignment="Stretch" />
    </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