Back to Devexpress

ContentDetailDescriptor.HeaderContent Property

wpf-devexpress-dot-xpf-dot-grid-dot-contentdetaildescriptor.md

latest8.5 KB
Original Source

ContentDetailDescriptor.HeaderContent Property

Gets or sets the detail section’s header content. This is a dependency property.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public object HeaderContent { get; set; }
vb
Public Property HeaderContent As Object

Property Value

TypeDescription
Object

An object specifying the detail section’s header content.

|

Remarks

Details display header sections when their DetailDescriptorBase.ShowHeader option is enabled. For details represented by ContentDetailDescriptor objects, header section content is specified by the HeaderContent property. If no template has been assigned to the DetailDescriptorBase.HeaderContentTemplate, then the header displays the textual representation of an assigned object. If a template has been assigned, then the HeaderContent property will define the DataContext for this template.

The following image shows a header section when no template is assigned to the DetailDescriptorBase.HeaderContentTemplate property.

This property’s textual representation is also used in tab headers when using a ContentDetailDescriptor within a TabViewDetailDescriptor. The following image illustrates this usage and also shows the DataViewBase.DetailHeaderContent property that should be used instead of HeaderContent when using a DataControlDetailDescriptor.

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 HeaderContent 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#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#L25

xml
<dxg:GridControl.DetailDescriptor>
    <dxg:ContentDetailDescriptor HeaderContent="Notes">
        <dxg:ContentDetailDescriptor.ContentTemplate>

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

csharp
customDetail.ContentTemplate = (DataTemplate)FindResource("notesTemplate");
customDetail.HeaderContent = nameof(Employee.Notes);

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

csharp
contentDetail.ContentTemplate = dt;
contentDetail.HeaderContent = "Notes";

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

vb
customDetail.ContentTemplate = CType(FindResource("notesTemplate"), DataTemplate)
customDetail.HeaderContent = NameOf(Employee.Notes)
Dim chartDetail As ContentDetailDescriptor = New ContentDetailDescriptor()

wpf-data-grid-display-custom-content-in-grid-details/VB/WpfApplication18/MainWindow.xaml.vb#L72

vb
contentDetail.HeaderContent = "Notes"

See Also

DetailHeaderContent

HeaderContentTemplate

ShowHeader

ContentDetailDescriptor Class

ContentDetailDescriptor Members

DevExpress.Xpf.Grid Namespace