FixedHeaders Property
See Also  Example
Xceed.Wpf.DataGrid Assembly > Xceed.Wpf.DataGrid.Views Namespace > ViewBase Class : FixedHeaders Property

Gets a collection that contains the items that are located in the fixed, non-scrollable header section of a grid.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property FixedHeaders As ObservableCollection(Of DataTemplate)
C# 
public ObservableCollection<DataTemplate> FixedHeaders {get;}

Return Value

An ObservableCollection of DataTemplates representing the items that are located in the fixed, non-scrollable header section of a grid.

Example

All examples in this topic assume that the grid is bound to the Orders table of the Northwind database, unless stated otherwise.
The following example demonstrates how to recreate the default card-view header, which contains a ColumnManagerRow to the right of a GroupByControl.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
  <Grid.Resources> 
    <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                       Source="{Binding Source={x:Static Application.Current}, 
                                                        Path=Orders}"/> 
  </Grid.Resources> 
  <xcdg:DataGridControl x:Name="OrdersGrid" 
                        ItemsSource="{Binding Source={StaticResource cvs_orders}}"> 
    <xcdg:DataGridControl.View> 
      <xcdg:CardView UseDefaultHeadersFooters="False"> 
        <xcdg:CardView.FixedHeaders> 
 
         <DataTemplate> 
           <DockPanel> 
             <!-- OneWay binding is used because we want the ColumnManagerRow's height to 
                  follow what is defined by the GroupByControl. A FallbackValue 
                  is specified so the initial measure pass has an acceptable minimal 
                  value.--> 
             <xcdg:ColumnManagerRow DockPanel.Dock="Right" 
                                    Height="{Binding ElementName=groupByControl, 
                                                     Path=ActualHeight, 
                                                     Mode=OneWay, 
                                                     FallbackValue=60}"/> 
             <xcdg:GroupByControl x:Name="groupByControl"/> 
           </DockPanel> 
         </DataTemplate> 
        </xcdg:CardView.FixedHeaders> 
      </xcdg:CardView> 
    </xcdg:DataGridControl.View> 
  </xcdg:DataGridControl> 
</Grid>
The following example demonstrates how to clear the content of all header and footer sections of a grid using its view's UseDefaultHeadersFooters property.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
  <Grid.Resources> 
    <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                    Source="{Binding Source={x:Static Application.Current}, 
                                                      Path=Orders}"/> 
   </Grid.Resources> 
   <xcdg:DataGridControl x:Name="OrdersGrid" 
                         ItemsSource="{Binding Source={StaticResource cvs_orders}}"> 
      <xcdg:DataGridControl.View> 
         <xcdg:CardView UseDefaultHeadersFooters="False"/> 
       </xcdg:DataGridControl.View> 
   </xcdg:DataGridControl> 
</Grid>
The following example demonstrates how to add an InsertionRow to the fixed header section of a grid.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
  <Grid.Resources> 
    <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                     Source="{Binding Source={x:Static Application.Current}, 
                                                       Path=Orders}"/> 
   </Grid.Resources> 
   <xcdg:DataGridControl x:Name="OrdersGrid" 
                         ItemsSource="{Binding Source={StaticResource cvs_orders}}"> 
      <xcdg:DataGridControl.View> 
         <xcdg:TableView> 
 
           <xcdg:TableView.FixedHeaders> 
              <DataTemplate> 
                 <xcdg:InsertionRow/> 
              </DataTemplate> 
           </xcdg:TableView.FixedHeaders> 
         </xcdg:TableView> 
      </xcdg:DataGridControl.View> 
   </xcdg:DataGridControl> 
</Grid>
The following example demonstrates how to prevent horizontal scrolling of the group-by control in the fixed header section.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
  <Grid.Resources> 
    <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                       Source="{Binding Source={x:Static Application.Current}, 
                                                        Path=Orders}"> 
      <xcdg:DataGridCollectionViewSource.GroupDescriptions> 
        <xcdg:DataGridGroupDescription PropertyName="ShipCountry"/> 
      </xcdg:DataGridCollectionViewSource.GroupDescriptions> 
    </xcdg:DataGridCollectionViewSource> 
  </Grid.Resources> 
 
  <xcdg:DataGridControl x:Name="OrdersGrid" 
                        ItemsSource="{Binding Source={StaticResource cvs_orders}}"> 
    <xcdg:DataGridControl.View> 
      <xcdg:TableView UseDefaultHeadersFooters="False"> 
        <xcdg:TableView.FixedHeaders> 
          <DataTemplate> 
            <xcdg:GroupByControl xcdg:TableView.CanScrollHorizontally="False"/> 
          </DataTemplate> 
          <DataTemplate> 
            <xcdg:ColumnManagerRow/> 
          </DataTemplate> 
        </xcdg:TableView.FixedHeaders> 
      </xcdg:TableView> 
    </xcdg:DataGridControl.View> 
  </xcdg:DataGridControl> 
</Grid>
The following example demonstrates how to retrieve a reference to an InsertionRow that is located in the fixed headers of a grid by handling its Loaded event.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
   <Grid.Resources> 
      <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                         Source="{Binding Source={x:Static Application.Current}, 
                                                          Path=Orders}" /> 
   </Grid.Resources> 
   <xcdg:DataGridControl x:Name="OrdersGrid" 
                         ItemsSource="{Binding Source={StaticResource cvs_orders}}"> 
      <xcdg:DataGridControl.View> 
         <xcdg:TableView> 
           <xcdg:TableView.FixedHeaders> 
              <DataTemplate> 
                 <xcdg:InsertionRow Loaded="InsertionRow_Loaded"/> 
              </DataTemplate> 
           </xcdg:TableView.FixedHeaders> 
        </xcdg:TableView>   
      </xcdg:DataGridControl.View> 
   </xcdg:DataGridControl>      
</Grid>

Requirements

Supported Frameworks: Microsoft .NET Framework version 3.5

See Also