In This Article

TreeListView Class

Represents an advanced multi-column tree view control.

public class TreeListView : TreeListBox
Inheritance:
object Visual UIElement FrameworkElement Control ItemsControl TreeListBox object
Derived:
PropertyGrid ShellListView

Constructors

TreeListView()

Initializes an instance of the TreeListView class.

public TreeListView()

Properties

AreColumnHeadersVisible

Gets or sets whether column headers are visible.

public bool AreColumnHeadersVisible { get; set; }

Property Value

bool:

true if column headers are visible; otherwise, false. The default value is true.

CanColumnsReorder

Gets or sets whether columns can be reordered by the end user.

public bool CanColumnsReorder { get; set; }

Property Value

bool:

true if columns can be reordered by the end user; otherwise, false. The default value is false.

CanColumnsResize

Gets or sets whether columns can be resized by the end user.

public bool CanColumnsResize { get; set; }

Property Value

bool:

true if columns can be resized by the end user; otherwise, false. The default value is true.

CanColumnsToggleVisibility

Gets or sets whether columns can have their visibility toggled by the end user.

public bool CanColumnsToggleVisibility { get; set; }

Property Value

bool:

true if columns can have their visibility toggled by the end user; otherwise, false. The default value is false.

ColumnHeaderHeight

Gets the height of the column header.

public double ColumnHeaderHeight { get; }

Property Value

double:

The height of the column header.

Columns

Gets the collection of columns in the control.

public ObservableCollection<TreeListViewColumn> Columns { get; }

Property Value

ObservableCollection<TreeListViewColumn>:

The collection of columns in the control.

ExpansionColumnIndex

Gets or sets the index of the columns that contains the indentation and expander button.

public int ExpansionColumnIndex { get; set; }

Property Value

int:

The index of the columns that contains the indentation and expander button. The default value is 0.

FrozenColumnCount

Gets or sets the number of non-scrolling columns, that are always displayed left-most and cannot be scrolled out of visibility.

public int FrozenColumnCount { get; set; }

Property Value

int:

The number of non-scrolling columns. The default value is 0.

IsDefaultColumnHeaderContextMenuEnabled

Gets or sets whether the default column header context menu is enabled.

public bool IsDefaultColumnHeaderContextMenuEnabled { get; set; }

Property Value

bool:

true if the default column header context menu is enabled; otherwise, false. The default value is true.

IsKeyboardFocusWithinContent

Gets whether keyboard focus is within the content area, and not in any header area.

protected override bool IsKeyboardFocusWithinContent { get; }

Property Value

bool:

true if keyboard focus is within the content area; otherwise, false.

SizeAllColumnsToFitCommand

Gets the ICommand that sizes all non-star width columns to fit.

public ICommand SizeAllColumnsToFitCommand { get; }

Property Value

ICommand:

The ICommand that sizes all non-star width columns to fit.

Methods

ArrangeOverride(Size)

When overridden in a derived class, positions child elements and determines a size for a FrameworkElement derived class.

protected override Size ArrangeOverride(Size finalSize)
Parameter Type Description
finalSize Size

The final area within the parent that this element should use to arrange itself and its children.

Returns

Size:

The actual size used.

ClearContainerForItemOverride(DependencyObject, object)

protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameter Type Description
element DependencyObject

The System.Windows.DependencyObject that is the wrapper element.

item object

The item that is being wrapped.

GetColumnHeaderVisibility(ScrollViewer)

Gets the value of the ColumnHeaderVisibility attached property for the specified object.

public static Visibility GetColumnHeaderVisibility(ScrollViewer obj)
Parameter Type Description
obj ScrollViewer

The object from which the property value is read.

Returns

Visibility:

The object's value.

GetContainerForItemOverride()

Creates or identifies the element used to display the specified item.

protected override DependencyObject GetContainerForItemOverride()

Returns

DependencyObject:

The element that is used to display the given item.

GetFrozenColumnsWidth(ScrollViewer)

Gets the value of the FrozenColumnsWidth attached property for the specified object.

public static double GetFrozenColumnsWidth(ScrollViewer obj)
Parameter Type Description
obj ScrollViewer

The object from which the property value is read.

Returns

double:

The object's value.

IsItemItsOwnContainerOverride(object)

Determines if the specified item is (or is eligible to be) its own item container.

protected override bool IsItemItsOwnContainerOverride(object item)
Parameter Type Description
item object

Specified item.

Returns

bool:

true if the item is its own item container; otherwise, false.

MeasureOverride(Size)

When overridden in a derived class, measures the size in layout required for child elements and determines a size for the FrameworkElement-derived class.

protected override Size MeasureOverride(Size availableSize)
Parameter Type Description
availableSize Size

The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.

Returns

Size:

The size that this element determines it needs during layout, based on its calculations of child element sizes.

OnApplyTemplate()

Invoked whenever application code or internal processes call ApplyTemplate.

public override void OnApplyTemplate()

OnColumnHeaderMenuRequested(TreeListViewColumnMenuEventArgs)

Occurs when a column header requests a context menu.

protected virtual void OnColumnHeaderMenuRequested(TreeListViewColumnMenuEventArgs e)
Parameter Type Description
e TreeListViewColumnMenuEventArgs

The TreeListViewColumnMenuEventArgs that contains the event data.

Remarks

This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

OnColumnHeaderTapped(TreeListViewColumnEventArgs)

Occurs when a column's header is tapped.

protected virtual void OnColumnHeaderTapped(TreeListViewColumnEventArgs e)
Parameter Type Description
e TreeListViewColumnEventArgs

The TreeListViewColumnEventArgs that contains the event data.

Remarks

This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

OnColumnIsVisibleChanged(TreeListViewColumnEventArgs)

Occurs when a column's visibility has changed.

protected virtual void OnColumnIsVisibleChanged(TreeListViewColumnEventArgs e)
Parameter Type Description
e TreeListViewColumnEventArgs

The TreeListViewColumnEventArgs that contains the event data.

Remarks

This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

OnColumnReordered(TreeListViewColumnEventArgs)

Occurs after a column is reordered by the end user.

protected virtual void OnColumnReordered(TreeListViewColumnEventArgs e)
Parameter Type Description
e TreeListViewColumnEventArgs

The TreeListViewColumnEventArgs that contains the event data.

Remarks

This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

OnColumnsResized(RoutedEventArgs)

Occurs after the ActualWidth of one or more columns changes.

protected virtual void OnColumnsResized(RoutedEventArgs e)
Parameter Type Description
e RoutedEventArgs

The RoutedEventArgs that contains the event data.

Remarks

This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

OnCreateAutomationPeer()

Returns an AutomationPeer object for this control instance.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

An AutomationPeer instance.

OnScrollViewerScrollChanged(ScrollChangedEventArgs)

Occurs when the scroll viewer's scroll is changed.

protected override void OnScrollViewerScrollChanged(ScrollChangedEventArgs e)
Parameter Type Description
e ScrollChangedEventArgs

The ScrollChangedEventArgs that contains data related to the event.

PrepareContainerForItemOverride(DependencyObject, object)

Prepares the specified element to display the specified item.

protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameter Type Description
element DependencyObject

The System.Windows.DependencyObject that is the wrapper element.

item object

The item that is being wrapped.

SetColumnHeaderVisibility(ScrollViewer, Visibility)

Sets the value of the ColumnHeaderVisibility attached property to the specified object.

public static void SetColumnHeaderVisibility(ScrollViewer obj, Visibility value)
Parameter Type Description
obj ScrollViewer

The object to which the attached property is written.

value Visibility

The value to set.

SetFrozenColumnsWidth(ScrollViewer, double)

Sets the value of the FrozenColumnsWidth attached property to the specified object.

public static void SetFrozenColumnsWidth(ScrollViewer obj, double value)
Parameter Type Description
obj ScrollViewer

The object to which the attached property is written.

value double

The value to set.

SizeAllColumnsToFit()

Sizes all non-star width columns to fit.

public void SizeAllColumnsToFit()

Events

ColumnHeaderMenuRequested

Occurs when a column header requests a context menu.

public event EventHandler<TreeListViewColumnMenuEventArgs> ColumnHeaderMenuRequested

Event Type

EventHandler<TreeListViewColumnMenuEventArgs>

ColumnHeaderTapped

Occurs when a column's header is tapped.

public event EventHandler<TreeListViewColumnEventArgs> ColumnHeaderTapped

Event Type

EventHandler<TreeListViewColumnEventArgs>

ColumnIsVisibleChanged

Occurs when a column's visibility has changed.

public event EventHandler<TreeListViewColumnEventArgs> ColumnIsVisibleChanged

Event Type

EventHandler<TreeListViewColumnEventArgs>

ColumnReordered

Occurs after a column is reordered by the end user.

public event EventHandler<TreeListViewColumnEventArgs> ColumnReordered

Event Type

EventHandler<TreeListViewColumnEventArgs>

ColumnsResized

Occurs after the ActualWidth of one or more columns changes.

public event RoutedEventHandler ColumnsResized

Event Type

RoutedEventHandler

Fields

AreColumnHeadersVisibleProperty

Identifies the AreColumnHeadersVisible dependency property. This field is read-only.

public static readonly DependencyProperty AreColumnHeadersVisibleProperty

CanColumnsReorderProperty

Identifies the CanColumnsReorder dependency property. This field is read-only.

public static readonly DependencyProperty CanColumnsReorderProperty

CanColumnsResizeProperty

Identifies the CanColumnsResize dependency property. This field is read-only.

public static readonly DependencyProperty CanColumnsResizeProperty

CanColumnsToggleVisibilityProperty

Identifies the CanColumnsToggleVisibility dependency property. This field is read-only.

public static readonly DependencyProperty CanColumnsToggleVisibilityProperty

ColumnHeaderHeightProperty

Identifies the ColumnHeaderHeight dependency property. This field is read-only.

public static readonly DependencyProperty ColumnHeaderHeightProperty

ColumnHeaderMenuRequestedEvent

Identifies the ColumnHeaderMenuRequested routed event. This field is read-only.

public static readonly RoutedEvent ColumnHeaderMenuRequestedEvent

ColumnHeaderTappedEvent

Identifies the ColumnHeaderTapped routed event. This field is read-only.

public static readonly RoutedEvent ColumnHeaderTappedEvent

ColumnHeaderVisibilityProperty

Identifies the ColumnHeaderVisibility dependency property. This field is read-only.

public static readonly DependencyProperty ColumnHeaderVisibilityProperty

ColumnIsVisibleChangedEvent

Identifies the ColumnIsVisibleChanged routed event. This field is read-only.

public static readonly RoutedEvent ColumnIsVisibleChangedEvent

ColumnReorderedEvent

Identifies the ColumnReordered routed event. This field is read-only.

public static readonly RoutedEvent ColumnReorderedEvent

ColumnsResizedEvent

Identifies the ColumnsResized routed event. This field is read-only.

public static readonly RoutedEvent ColumnsResizedEvent

ExpansionColumnIndexProperty

Identifies the ExpansionColumnIndex dependency property. This field is read-only.

public static readonly DependencyProperty ExpansionColumnIndexProperty

FrozenColumnCountProperty

Identifies the FrozenColumnCount dependency property. This field is read-only.

public static readonly DependencyProperty FrozenColumnCountProperty

FrozenColumnsWidthProperty

Identifies the FrozenColumnsWidth dependency property. This field is read-only.

public static readonly DependencyProperty FrozenColumnsWidthProperty

IsDefaultColumnHeaderContextMenuEnabledProperty

Identifies the IsDefaultColumnHeaderContextMenuEnabled dependency property. This field is read-only.

public static readonly DependencyProperty IsDefaultColumnHeaderContextMenuEnabledProperty

Inherited Members