Xceed DataGrid for WPF v7.2 Documentation
TreeGridflowView Class
Members  Example 


Xceed.Wpf.DataGrid Assembly > Xceed.Wpf.DataGrid.Views Namespace : TreeGridflowView Class

Represents a table-view layout similar to TableflowView, in which rows are laid out horizontally as in traditional grid-like styles, but detail columns are aligned with the columns of the master, and one column displays data using a tree-structure.

Like TableflowView, it provides animated smooth scrolling, sticky group headers and sticky master-detail master row and headers, full-column animated drag and drop reordering. (See limitations below.)

Syntax
'Declaration
 
<MasterDetailLayoutAttribute(MasterDetailLayoutMode.Flatten)>
<StyleTypedPropertyAttribute(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)>
<XmlLangPropertyAttribute("Language")>
<UsableDuringInitializationAttribute(True)>
<RuntimeNamePropertyAttribute("Name")>
<TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)>
<NameScopePropertyAttribute("NameScope", System.Windows.NameScope)>
Public Class TreeGridflowView 
   Inherits TableflowView
'Usage
 
Dim instance As TreeGridflowView
[MasterDetailLayout(MasterDetailLayoutMode.Flatten)]
[StyleTypedProperty(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)]
[XmlLangProperty("Language")]
[UsableDuringInitialization(true)]
[RuntimeNameProperty("Name")]
[TypeDescriptionProvider(MS.Internal.ComponentModel.DependencyObjectProvider)]
[NameScopeProperty("NameScope", System.Windows.NameScope)]
public class TreeGridflowView : TableflowView 
Remarks

The View property of the DataGridControl class determines which view is applied to a grid. If the View property is left to its default value, null (Nothing in Visual Basic), or explicitly set to null, the default table-view layout will be used with the system color scheme. The Theme property of the View class can be set to change the color scheme applied to a grid's elements. If left to its default value, null, the system color scheme will be used. In either case, if the system-color theme is not recognized (e.g., a third-party color scheme is being used), the Aero normal-color theme will be used.

Views and themes can be set through attribute syntax or property element syntax. To change the default view and/or theme using attribute syntax, the name of the view to use (e.g., CardView) must be provided, optionally followed by the name of the theme class (e.g., NormalColorTheme), or the name of the class without the "Theme" portion. If the theme is omitted, the default Aero normal-color theme will be used.

Fixed Columns vs. Templates  

In order to support fixed columns when creating a new row template for a table-view layout, the following criteria must be met:

  1. The PART_CellsHost template part must be a FixedCellPanel.
  2. The FixedCellCount property of the FixedCellPanel must be bound to the table view's FixedColumnCount property using a TwoWay ViewBinding.

The fixed-cell-panel properties listed below are also usually bound when provided a new row template for a table-view layout:

  1. SplitterStyle (TemplateBinding xcdg:TableView.FixedColumnSplitterStyle)
  2. SplitterWidth (xcdg:ViewBinding FixedColumnSplitterWidth)
  3. ShowSplitter (xcdg:ViewBinding ShowFixedColumnSplitter)
  4. FixedColumnDropMarkPen (xcdg:ViewBinding FixedColumnDropMarkPen)

If a new template is provided for a DataGridControl and fixed columns are to be supported, it is essential that a TableViewScrollViewer be used. This scroll viewer is responsible for preserving the TranslateTransforms that fix and scroll elements, as well as executing the PageLeft and PageRight actions according to the reduced viewport.  It is also recommended that an AdornerDecorator be located above the TableViewScrollViewer of the templated DataGridControl to support drag and dropping of the fixed-column splitter correctly.

Behavior and limitations

Only item properties and columns defined at the first (master) level are used to define the columns presented in the datagrid: the extra item properties and columns defined in the details will not be used.

Sorting, reordering, and resizing are restricted to the master level: Other levels simply synchronize with the master level. Even if a ColumnManagerRow is displayed in details, only the the ColumnManagerCell of the first level (master) allows sorting, dragging, or resizing. Furthermore, the column marked as the main column (ColumnBase.IsMainColumn is set to true) cannot be dragged and no column can be moved to the left of it (it is always the first column).

Sorting applied to the first level is applied to the other (detail) levels.

By default, the headers and footers of details in this view are empty. There is no ColumnManagerRow, unlike in TableflowView.

If the Synonym property of DataGridItemPropertyBase is not set, the default behavior is to associate the DataGridItemPropertyBase instances with the same name (Name). The purpose of the Synonym property is to allow an association of DataGridItemPropertyBase instances that do not share the same name. Note that in order for the DataGridItemPropertyBase instances to be associated and aligned, they must be of the same data type (.DataType).

The TreeGridflowView class must not be seen as a view that aligns columns but rather as a view that aligns properties.

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 demonstrates how to set up a TreeGridflowView.
<xcdg:DataGridControl x:Name="grid"
                      ItemsSource="{Binding Source={StaticResource cvsEmployees}}"
                      FlowDirection="{Binding Source={x:Static local:ConfigurationData.Singleton}, Path=FlowDirection}"
                      ReadOnly="True">

    <xcdg:DataGridControl.Columns>
      <xcdg:Column FieldName="Photo"
                    IsMainColumn="True" />

      <xcdg:Column FieldName="FirstName" />

      <xcdg:Column FieldName="LastName" />

      <xcdg:Column FieldName="Title" />

      <xcdg:Column FieldName="HireDate"
                    CellContentTemplate="{StaticResource shortDateCellDataTemplate}" />

      <xcdg:Column FieldName="BirthDate"
                    CellContentTemplate="{StaticResource shortDateCellDataTemplate}" />

      <xcdg:Column FieldName="Country" 
                    CellContentTemplate="{StaticResource countryCellContentTemplate}" />

      <!-- The other columns will be added after these ones and will have default 
            appearance and behavior when they are automatically added upon loading. -->
    </xcdg:DataGridControl.Columns>

    <xcdg:DataGridControl.DetailConfigurations>
      <xcdg:DetailConfiguration RelationName="SubEmployees"
                                AutoCreateDetailConfigurations="False">

          <xcdg:DetailConfiguration.Columns>
            <xcdg:Column FieldName="HireDate"
                          CellContentTemplate="{StaticResource shortDateCellDataTemplate}" />

            <xcdg:Column FieldName="BirthDate"
                          CellContentTemplate="{StaticResource shortDateCellDataTemplate}" />

            <xcdg:Column FieldName="Country" 
                          CellContentTemplate="{StaticResource countryCellContentTemplate}" />
          </xcdg:DetailConfiguration.Columns>

          <xcdg:DetailConfiguration.DetailConfigurations>
            <xcdg:DetailConfiguration RelationName="SubEmployees"
                                      AutoCreateDetailConfigurations="False">

                <xcdg:DetailConfiguration.Columns>
                  <xcdg:Column FieldName="HireDate"
                                CellContentTemplate="{StaticResource shortDateCellDataTemplate}" />

                  <xcdg:Column FieldName="BirthDate"
                                CellContentTemplate="{StaticResource shortDateCellDataTemplate}" />

                  <xcdg:Column FieldName="Country" 
                                CellContentTemplate="{StaticResource countryCellContentTemplate}" />
                        
                </xcdg:DetailConfiguration.Columns>

            </xcdg:DetailConfiguration>
          </xcdg:DetailConfiguration.DetailConfigurations>

      </xcdg:DetailConfiguration>
    </xcdg:DataGridControl.DetailConfigurations>

    <xcdg:DataGridControl.View>
      <!-- In this sample, you can define this resource to specify the default 
            theme this DataGridControl will be in. This is not mandatory, so we
            use a DynamicResource to silently ignore its absence. -->
      <xcdg:TreeGridflowView Theme="{DynamicResource defaultTheme}"
                              UseDefaultHeadersFooters="False"
                              ShowFixedColumnSplitter="{Binding Source={x:Static local:ConfigurationData.Singleton}, Path=ShowFixedColumnSplitter}"
                              IsAlternatingRowStyleEnabled="{Binding Source={x:Static local:ConfigurationData.Singleton}, Path=IsAlternatingRowStyleEnabled}" />
    </xcdg:DataGridControl.View>
</xcdg:DataGridControl>
Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.ContentElement
            System.Windows.FrameworkContentElement
               Xceed.Wpf.DataGrid.Views.ViewBase
                  Xceed.Wpf.DataGrid.Views.UIViewBase
                     Xceed.Wpf.DataGrid.Views.TableView
                        Xceed.Wpf.DataGrid.Views.TableflowView
                           Xceed.Wpf.DataGrid.Views.TreeGridflowView

Requirements

Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

TreeGridflowView Members
Xceed.Wpf.DataGrid.Views Namespace