You are viewing help content for pre-release software. This document and the features it describes are subject to change. Switch to the current version.

ContentDetailDescriptor Class

Represents a Detail with freely-customizable content.

Namespace: DevExpress.Xpf.Grid

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

Declaration

public class ContentDetailDescriptor :
    DetailDescriptorBase
Public Class ContentDetailDescriptor
    Inherits 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>
See Also