Back to Devexpress

ContentDetailDescriptor Class

wpf-devexpress-dot-xpf-dot-grid-41013c9e.md

latest9.4 KB
Original Source

ContentDetailDescriptor Class

Represents a Detail with freely-customizable content.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public class ContentDetailDescriptor :
    DetailDescriptorBase
vb
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:

MemberDescription
DetailDescriptorBase.ContentTemplateGets or sets the template specifying the entire or partial content of a Detail.
ContentDetailDescriptor.HeaderContentGets 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.

View Example: Display Chart Control in Grid Details

xaml
<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.

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

xml
</dxg:DataControlDetailDescriptor>
    <dxg:ContentDetailDescriptor ContentTemplate="{StaticResource EmployeeNotes}" HeaderContent="Notes"/>
</dxg:TabViewDetailDescriptor>

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

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

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

xml
<dxg:GridControl.DetailDescriptor>
    <dxg:ContentDetailDescriptor>
        <dxg:ContentDetailDescriptor.ContentTemplate>

Inheritance

Show 11 items

Object DispatcherObject DependencyObject ContentElement FrameworkContentElement DXFrameworkContentElement DetailDescriptorBase ContentDetailDescriptor MultiDetailDescriptor

DetailDescriptorSelector

TabViewDetailDescriptor

See Also

ContentDetailDescriptor Members

DataControlDetailDescriptor

TabViewDetailDescriptor

DetailDescriptor

Display Custom Content in Grid Details

DevExpress.Xpf.Grid Namespace