[Root] / Xceed.Wpf.DataGrid Assembly / Xceed.Wpf.DataGrid.Views.Surfaces Namespace / RegionConfiguration Class / Template Property
Example


In This Topic
    Template Property (RegionConfiguration)
    In This Topic
    Gets or sets the DataTemplate that can be used to change the layout of the fields in the region.
    Syntax
    'Declaration
     
    Public Property Template As DataTemplate
    'Usage
     
    Dim instance As RegionConfiguration
    Dim value As DataTemplate
     
    instance.Template = value
     
    value = instance.Template
    public DataTemplate Template {get; set;}

    Property Value

    A DataTemplate that can be used to change the layout of the fields in the region.
    Remarks
    If the fields in the region are to be edited, then DataCells must be used in the template. If no editing is required, then any other element (e.g., TextBlock) can be used or the ReadOnly property set to true.
    Example

    All examples in this topic assume that the grid is bound to the Employees table of the Northwind database, unless stated otherwise

    The following example demonstrates how to provide a default title-region configuration that will be used by all surfaces that display a title.
    <Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
      <Grid.Resources>
       <xcdg:DataGridCollectionViewSource x:Key="cvs_employees"
                                       Source="{Binding Source={x:Static Application.Current}, Path=EmployeesTable}"/>
     
      </Grid.Resources>
     
      <xcdg:DataGridControl x:Name="EmployeesGrid"
                          ItemsSource="{Binding Source={StaticResource cvs_employees}}">
     
       <xcdg:DataGridControl.View>
          <xcdg:CardflowView3D>
             <xcdg:CardflowView3D.Theme>
                <xcdg:ElementalBlackTheme>
    
                  <!-- The DefaultTitleRegionConfiguration will be applied to all title regions in all surfaces
                       for which a RegionConfiguration has not been explicitly provided. -->
                  <xcdg:ElementalBlackTheme.DefaultTitleRegionConfiguration>
                     <xcdg:RegionConfiguration FieldNames="TitleOfCourtesy, FirstName, LastName, Title"
                                               ReadOnly="True">
                        <xcdg:RegionConfiguration.Template>
                           <DataTemplate>
                              <Viewbox>
                                 <StackPanel>
                                    <StackPanel Orientation="Horizontal"
                                                HorizontalAlignment="Center">
                                       <StackPanel.Resources>
                                          <Style TargetType="{x:Type xcdg:DataCell}">
                                             <Setter Property="Margin"
                                                     Value="0, 0, 3, 0"/>
                                          </Style>
                                       </StackPanel.Resources>
                                       <xcdg:DataCell FieldName="TitleOfCourtesy"/>
                                       <xcdg:DataCell FieldName="FirstName"/>
                                       <xcdg:DataCell FieldName="LastName"/>
                                    </StackPanel>
                                    <xcdg:DataCell FieldName="Title"
                                                   TextElement.FontSize="10"
                                                   HorizontalContentAlignment="Center"/>
                                 </StackPanel>
                              </Viewbox>
                           </DataTemplate>
                        </xcdg:RegionConfiguration.Template>
                     </xcdg:RegionConfiguration>
                  </xcdg:ElementalBlackTheme.DefaultTitleRegionConfiguration>
                </xcdg:ElementalBlackTheme>
             </xcdg:CardflowView3D.Theme>
          </xcdg:CardflowView3D>
        </xcdg:DataGridControl.View>
      </xcdg:DataGridControl>
    </Grid>
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Framework: net20, net35, net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also