EnhancedTreeView ClassDW.WPFToolkit Documentation
Enhances the TreeView with:
* multi select, * stretching of its child items over the whole width, * select an item by rightclick on it and * a two way bindable SelectedItem.
Inheritance Hierarchy

SystemObject
  System.Windows.ThreadingDispatcherObject
    System.WindowsDependencyObject
      System.Windows.MediaVisual
        System.WindowsUIElement
          System.WindowsFrameworkElement
            System.Windows.ControlsControl
              System.Windows.ControlsItemsControl
                System.Windows.ControlsTreeView
                  DW.WPFToolkit.ControlsEnhancedTreeView
                    DW.WPFToolkit.ControlsTreeListView

Namespace: DW.WPFToolkit.Controls
Assembly: DW.WPFToolkit (in DW.WPFToolkit.dll) Version: 5.6.0.0
Syntax

C#
public class EnhancedTreeView : TreeView

The EnhancedTreeView type exposes the following members.

Constructors

  NameDescription
Public methodEnhancedTreeView
Initializes a new instance of the EnhancedTreeView class.
Top
Methods

  NameDescription
Protected methodGetContainerForItemOverride
Generates a new child item container to hold in the EnhancedTreeView.
(Overrides TreeViewGetContainerForItemOverride.)
Protected methodIsItemItsOwnContainerOverride
Checks if the item is already the correct item container. If not the GetContainerForItemOverride will be used to generate the right container.
(Overrides TreeViewIsItemItsOwnContainerOverride(Object).)
Protected methodOnSelectedItemChanged
Handles the selection chaning depending on the SelectionMode.
(Overrides TreeViewOnSelectedItemChanged(RoutedPropertyChangedEventArgsObject).)
Top
Fields

  NameDescription
Public fieldStatic memberAutoExpandSelectedProperty
Identifies the AutoExpandSelected dependency property.
Public fieldStatic memberItemsContentStretchingProperty
Identifies the ItemsContentStretching dependency property.
Public fieldStatic memberSelectedElementProperty
Identifies the SelectedElement dependency property.
Public fieldStatic memberSelectedItemChangedCommandProperty
Identifies the SelectedItemChangedCommand dependency property.
Public fieldStatic memberSelectionModeProperty
Identifies the SelectionMode dependency property.
Top
Properties

  NameDescription
Public propertyAutoExpandSelected
Gets or sets a value which indicates if the TreeViewItems gets expanded automatically to the selected item when using SelectedElement.
Public propertyItemsContentStretching
Gets or sets a value which indicates of the child tree view items should be stretched over the whole control width or not.
Public propertySelectedElement
Gets or sets the selected item in the tree.
Public propertySelectedItemChangedCommand
Gets or sets the command to be executed if a item got selected.
Public propertySelectedItems
Gets all selected items in the tree view. If nothing is selected an empty list is returned.
Public propertySelectedTreeViewItems
Gets the selected tree view item container.
Public propertySelectionMode
Gets or set a value which indicates how items can be selected in the tree view.
Top
Examples

XAML
<WPFToolkit:EnhancedTreeView SelectedItems="{Binding Items}">
                             SelectionMode="Extended">
</WPFToolkit:EnhancedTreeView>

<Controls:EnhancedTreeView ItemsSource="{Binding Folders}"
                           SelectedElement="{Binding SelectedItem, Mode=TwoWay}"
                           AutoExpandSelected="True">
    <TreeView.ItemTemplate>
        <HierarchicalDataTemplate ItemsSource="{Binding Folders}">
            <TextBlock Text="{Binding Name}" />
        </HierarchicalDataTemplate>
    </TreeView.ItemTemplate>
</Controls:EnhancedTreeView>
See Also

Reference