menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TreeViewItem - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class TreeViewItem

    Represents a item of data in a SfTreeView control.

    Inheritance
    System.Object
    TreeViewItem
    Implements
    System.IDisposable
    Namespace: Syncfusion.UI.Xaml.TreeView
    Assembly: Syncfusion.SfTreeView.WPF.dll
    Syntax
    public class TreeViewItem : Control, IDisposable

    Constructors

    TreeViewItem()

    Initializes a new instance of the TreeViewItem class.

    Declaration
    public TreeViewItem()

    Fields

    ExpanderPositionProperty

    Identifies the ExpanderPosition dependency property.

    Declaration
    public static readonly DependencyProperty ExpanderPositionProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ExpanderTemplateProperty

    Identifies the ExpanderTemplate dependency property.

    Declaration
    public static readonly DependencyProperty ExpanderTemplateProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ExpanderWidthProperty

    Identifies the ExpanderWidth dependency property.

    Declaration
    public static readonly DependencyProperty ExpanderWidthProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    FullRowSelectProperty

    Identifies the FullRowSelect dependency property.

    Declaration
    public static readonly DependencyProperty FullRowSelectProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    IndentationWidthProperty

    Identifies the IndentationWidth dependency property.

    Declaration
    public static readonly DependencyProperty IndentationWidthProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ItemTemplateProperty

    Identifies the ItemTemplate dependency property.

    Declaration
    public static readonly DependencyProperty ItemTemplateProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ShowLinesProperty

    Identifies the ShowLines dependency property.

    Declaration
    public static readonly DependencyProperty ShowLinesProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    Properties

    ExpanderPosition

    Gets or sets the expander position for TreeViewItem. The default value is Start Fields:

    EnumerationDescription
    StartThe expander view will be displayed in start position of TreeViewItem.
    EndThe expander view will be displayed in end position of TreeViewItem.

    Declaration
    public ExpanderPosition ExpanderPosition { get; set; }
    Property Value
    Type
    ExpanderPosition

    ExpanderTemplate

    Gets or sets the data template for the Expander View in TreeViewItem.

    Declaration
    public DataTemplate ExpanderTemplate { get; set; }
    Property Value
    Type
    System.Windows.DataTemplate
    Remarks

    TreeViewNode will be the data context for each TreeViewItem.

    ExpanderWidth

    Gets or sets the expander width for TreeViewItem.

    Declaration
    public double ExpanderWidth { get; set; }
    Property Value
    Type Description
    System.Double

    The default value is 20.

    FullRowSelect

    Gets or sets a value indicating whether the selection spans the width of tree view control.

    Declaration
    public bool FullRowSelect { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false, where the selection start from indent level only.

    IndentationWidth

    Gets or sets the distance to indent for each TreeViewItem.

    Declaration
    public double IndentationWidth { get; set; }
    Property Value
    Type
    System.Double

    ItemTemplate

    Gets or sets the data template for the Content View in TreeViewItem.

    Declaration
    public DataTemplate ItemTemplate { get; set; }
    Property Value
    Type
    System.Windows.DataTemplate
    Remarks

    TreeViewNode will be the data context for each TreeViewItem.

    ShowLines

    Gets or sets a value indicating whether lines are drawn in the TreeViewItem.

    Declaration
    public bool ShowLines { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if lines are drawn in TreeViewItem; otherwise, false. The default value is false.

    TreeViewItemInfo

    Gets the TreeViewItemInfoBase details of the TreeViewItem.

    Declaration
    public TreeViewItemInfoBase TreeViewItemInfo { get; }
    Property Value
    Type
    TreeViewItemInfoBase

    Methods

    Dispose()

    Dispose all the allocated resources.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Dispose the instances, if parameter is true.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Represents the boolean value for disposing objects.

    OnApplyTemplate()

    Builds the visual tree for the TreeViewItem.

    Declaration
    public override void OnApplyTemplate()

    OnContextMenuOpening(ContextMenuEventArgs)

    Occurs when context menu on the TreeViewItem is opened.

    Declaration
    protected override void OnContextMenuOpening(ContextMenuEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Controls.ContextMenuEventArgs e

    The ContextMenuEventArgs that contains event data.

    OnCreateAutomationPeer()

    Declaration
    protected override AutomationPeer OnCreateAutomationPeer()
    Returns
    Type
    System.Windows.Automation.Peers.AutomationPeer

    OnMouseDoubleClick(MouseButtonEventArgs)

    Occurs when mouse is clicked two times over the item.

    Declaration
    protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseButtonEventArgs e

    The System.Windows.Input.MouseButtonEventArgs that contains the event data.

    OnMouseDown(MouseButtonEventArgs)

    Invoked when the MouseDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

    Declaration
    protected override void OnMouseDown(MouseButtonEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseButtonEventArgs e

    The System.Windows.Input.MouseButtonEventArgs that contains the event data.

    OnMouseEnter(MouseEventArgs)

    Invoked when the MouseEnter attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

    Declaration
    protected override void OnMouseEnter(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseEventArgs e

    The MouseEventArgs that contains the event data.

    OnMouseLeave(MouseEventArgs)

    Invoked when the MouseLeave attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

    Declaration
    protected override void OnMouseLeave(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseEventArgs e

    The MouseEventArgs that contains the event data.

    OnMouseLeftButtonUp(MouseButtonEventArgs)

    Occurs when mouse left button is released over the item.

    Declaration
    protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseButtonEventArgs e

    The System.Windows.Input.MouseButtonEventArgs that contains the event data.

    OnMouseUp(MouseButtonEventArgs)

    Invoked when the MouseUp attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

    Declaration
    protected override void OnMouseUp(MouseButtonEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseButtonEventArgs e

    The System.Windows.Input.MouseButtonEventArgs that contains the event data.

    OnPreviewMouseDown(MouseButtonEventArgs)

    Invoked when the PreviewMouseDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

    Declaration
    protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseButtonEventArgs e

    The System.Windows.Input.MouseButtonEventArgs that contains the event data.

    OnPreviewMouseUp(MouseButtonEventArgs)

    Invoked when the PreviewMouseUp attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

    Declaration
    protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseButtonEventArgs e

    The System.Windows.Input.MouseButtonEventArgs that contains the event data.

    OnTouchDown(TouchEventArgs)

    Occurs when the item is touched.

    Declaration
    protected override void OnTouchDown(TouchEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.TouchEventArgs e

    The System.Windows.Input.TouchEventArgs that contains the event data.

    OnTouchUp(TouchEventArgs)

    Occurs when touch over the item is released.

    Declaration
    protected override void OnTouchUp(TouchEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.TouchEventArgs e

    The System.Windows.Input.TouchEventArgs that contains the event data.

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved