Class RadTreeView
A hierarchical control used to display a tree of items.
Inheritance
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.Navigation.dll
Syntax
[TelerikToolboxCategory("Navigation")]
[ScriptableType]
[Themable]
public class RadTreeView : ItemsControl, IScrollingServiceCore, IScrollingInfo, IThemable
Remarks
The RadTreeView control is used to display a list of items. The RadTreeView control supports the following features:
items
The RadTreeView control is made up of tree of items represented
by Rad
Each item has a System.
Constructors
RadTreeView()
Initializes a new instance of the RadTreeView class.
Declaration
public RadTreeView()
Remarks
Use this constructor to create and initialize a new instance of the RadTreeView control.
Fields
AutoScrollToSelectedItemProperty
Identifies the AutoScrollToSelectedItem property.
Declaration
public static readonly DependencyProperty AutoScrollToSelectedItemProperty
Field Value
System.
|
BringIntoViewModeProperty
Identifies the BringIntoView property.
Declaration
public static readonly DependencyProperty BringIntoViewModeProperty
Field Value
System.
|
CheckedItemsProperty
Identifies the CheckedItemsProperty dependency property.
Declaration
public static readonly DependencyProperty CheckedItemsProperty
Field Value
System.
|
DragEndedEvent
Identifies the DragEnded routed event.
Declaration
public static readonly RoutedEvent DragEndedEvent
Field Value
System.
|
DragOverTreeEvent
Identifies the DragOverTree routed event.
Declaration
public static readonly RoutedEvent DragOverTreeEvent
Field Value
System.
|
DragStartedEvent
Identifies the DragStarted routed event.
Declaration
public static readonly RoutedEvent DragStartedEvent
Field Value
System.
|
DropExpandDelayProperty
Identifies the DropExpandDelay property.
Declaration
public static readonly DependencyProperty DropExpandDelayProperty
Field Value
System.
|
ExpanderStyleProperty
Identifies the ExpanderStyle dependency property.
Declaration
public static readonly DependencyProperty ExpanderStyleProperty
Field Value
System.
|
ImagesBaseDirProperty
Identifies the ImagesBaseDirectory dependency property.
Declaration
public static readonly DependencyProperty ImagesBaseDirProperty
Field Value
System.
|
IsDragDropEnabledProperty
Identifies the IsDragDropEnabled dependency property.
Declaration
public static readonly DependencyProperty IsDragDropEnabledProperty
Field Value
System.
|
IsDragPreviewEnabledProperty
Identifies the IsDragPreviewEnabled dependency property.
Declaration
public static readonly DependencyProperty IsDragPreviewEnabledProperty
Field Value
System.
|
IsDragTooltipEnabledProperty
Identifies the IsDragTooltipEnabled dependency property.
Declaration
public static readonly DependencyProperty IsDragTooltipEnabledProperty
Field Value
System.
|
IsDropPreviewLineEnabledProperty
Identifies the IsDropPreviewLineEnabled dependency property.
Declaration
public static readonly DependencyProperty IsDropPreviewLineEnabledProperty
Field Value
System.
|
IsEditableProperty
Identifies the IsEditable dependency property.
Declaration
public static readonly DependencyProperty IsEditableProperty
Field Value
System.
|
IsExpandOnDblClickEnabledProperty
Identifies the IsExpandOnDoubleClickEnabled dependency property.
Declaration
public static readonly DependencyProperty IsExpandOnDblClickEnabledProperty
Field Value
System.
|
IsExpandOnSingleClickEnabledProperty
Identifies the IsExpandOnSingleClickEnabled dependency property.
Declaration
public static readonly DependencyProperty IsExpandOnSingleClickEnabledProperty
Field Value
System.
|
IsLineEnabledProperty
Identifies the IsLineEnabled dependency property.
Declaration
public static readonly DependencyProperty IsLineEnabledProperty
Field Value
System.
|
IsLoadOnDemandEnabledProperty
Identifies the IsLoadOnDemandEnabled dependency property.
Declaration
public static readonly DependencyProperty IsLoadOnDemandEnabledProperty
Field Value
System.
|
IsOptionElementsEnabledProperty
Identifies the IsOptionElementsEnabled dependency property.
Declaration
public static readonly DependencyProperty IsOptionElementsEnabledProperty
Field Value
System.
|
IsRootLinesEnabledProperty
Identifies the IsRootLinesEnabled dependency property.
Declaration
public static readonly DependencyProperty IsRootLinesEnabledProperty
Field Value
System.
|
IsSingleExpandPathProperty
Identifies the IsSingleExpandPath dependency property.
Declaration
public static readonly DependencyProperty IsSingleExpandPathProperty
Field Value
System.
|
IsTriStateModeProperty
Identifies the IsTriStateMode dependency property.
Declaration
public static readonly DependencyProperty IsTriStateModeProperty
Field Value
System.
|
ItemEditTemplateProperty
Identifies the ItemEditTemplate dependency property.
Declaration
public static readonly DependencyProperty ItemEditTemplateProperty
Field Value
System.
|
ItemEditTemplateSelectorProperty
Identifies the ItemEditTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty ItemEditTemplateSelectorProperty
Field Value
System.
|
ItemsIndentProperty
Identifies the ItemsIndent dependency property.
Declaration
public static readonly DependencyProperty ItemsIndentProperty
Field Value
System.
|
PathSeparatorProperty
Identifies the PathSeparator dependency property.
Declaration
public static readonly DependencyProperty PathSeparatorProperty
Field Value
System.
|
PerformSelectionOnMouseUpProperty
Identifies the PerformSelectionOnMouseUp property.
Declaration
public static readonly DependencyProperty PerformSelectionOnMouseUpProperty
Field Value
System.
|
PreviewDragEndedEvent
Identifies the PreviewDragEnded routed event.
Declaration
public static readonly RoutedEvent PreviewDragEndedEvent
Field Value
System.
|
PreviewDragStartedEvent
Identifies the PreviewDragStarted routed event.
Declaration
public static readonly RoutedEvent PreviewDragStartedEvent
Field Value
System.
|
PreviewSelectionChangedEvent
Identifies the PreviewSelectionChanged routed event.
Declaration
public static readonly RoutedEvent PreviewSelectionChangedEvent
Field Value
System.
|
SelectedContainerProperty
Identifies the SelectedContainer property.
Declaration
public static readonly DependencyProperty SelectedContainerProperty
Field Value
System.
|
SelectedItemProperty
Identifies the SelectedItem property.
Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
System.
|
SelectedItemsProperty
Identifies the SelectedItemsProperty dependency property.
Declaration
public static readonly DependencyProperty SelectedItemsProperty
Field Value
System.
|
SelectedValuePathProperty
Identifies the SelectedValuePath dependency property.
Declaration
public static readonly DependencyProperty SelectedValuePathProperty
Field Value
System.
|
SelectedValueProperty
Identifies the SelectedValue dependency property.
Declaration
public static readonly DependencyProperty SelectedValueProperty
Field Value
System.
|
SelectionChangedEvent
Identifies the SelectionChanged routed event.
Declaration
public static readonly RoutedEvent SelectionChangedEvent
Field Value
System.
|
SelectionModeProperty
Identifies the SelectionMode dependency property.
Declaration
public static readonly DependencyProperty SelectionModeProperty
Field Value
System.
|
TextDropAfterProperty
Identifies the TextDropAfter dependency property.
Declaration
public static readonly DependencyProperty TextDropAfterProperty
Field Value
System.
|
TextDropBeforeProperty
Identifies the TextDropBefore dependency property.
Declaration
public static readonly DependencyProperty TextDropBeforeProperty
Field Value
System.
|
TextDropInProperty
Identifies the TextDropIn dependency property.
Declaration
public static readonly DependencyProperty TextDropInProperty
Field Value
System.
|
TextDropRootProperty
Identifies the TextDropRoot dependency property.
Declaration
public static readonly DependencyProperty TextDropRootProperty
Field Value
System.
|
TextSearchModeProperty
Identifies the TextSearchMode dependency property.
Declaration
public static readonly DependencyProperty TextSearchModeProperty
Field Value
System.
|
Properties
AutoScrollToSelectedItem
Gets or sets a value indicating whether the selected RadTreeViewItem should be scrolled into the viewport. When using virtualization this property works only for realized RadTreeViewItem(s).
Declaration
public bool AutoScrollToSelectedItem { get; set; }
Property Value
System.
|
BringIntoViewMode
Gets or sets whether just the item's header should be brought into view when the respective methods are called of the header and its items.
Declaration
public BringIntoViewMode BringIntoViewMode { get; set; }
Property Value
CheckedItems
Gets a collection containing the items that are currently checked.
Declaration
[ScriptableMember]
public ICollection<object> CheckedItems { get; }
Property Value
System.
|
DropExpandDelay
Gets or sets the time has to pass before an item will be expanded because of something being dragged over it. This is a dependency property.
Declaration
public TimeSpan DropExpandDelay { get; set; }
Property Value
System.
|
ExpanderStyle
Gets or sets the style of RadTreeViewItem expander button.
Declaration
public Style ExpanderStyle { get; set; }
Property Value
System.
|
Remarks
The expander button is a ToggleButton. To modify the appearance of the expander first create a Style for a ToggleButton and then set the defined style to this property.
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
ExpanderStyleInherited="{StaticResource MyExpanderStyle}"/>
ImagesBaseDir
Gets or sets the directory where image files used for the TreeView images.
Declaration
[ScriptableMember]
public string ImagesBaseDir { get; set; }
Property Value
System.
|
IsDragDropEnabled
Gets or sets a value indicating whether drag and drop is enabled.
Declaration
[ScriptableMember]
public bool IsDragDropEnabled { get; set; }
Property Value
System.
|
IsDragPreviewEnabled
Gets or sets a value indicating whether drag feedback is shown while dragging.
Declaration
[ScriptableMember]
public bool IsDragPreviewEnabled { get; set; }
Property Value
System.
|
IsDragTooltipEnabled
Gets or sets a value indicating whether drag tooltip is shown while dragging.
Declaration
[ScriptableMember]
public bool IsDragTooltipEnabled { get; set; }
Property Value
System.
|
IsDropPreviewLineEnabled
Gets or sets a value indicating whether drag outline is shown while dragging.
Declaration
[ScriptableMember]
public bool IsDropPreviewLineEnabled { get; set; }
Property Value
System.
|
IsEditable
Gets or sets a value indicating whether the user can edit the TreeViewItems.
Declaration
[ScriptableMember]
public bool IsEditable { get; set; }
Property Value
System.
|
IsEditing
Gets if there is an open editor in the tree view.
Declaration
[ScriptableMember]
public virtual bool IsEditing { get; }
Property Value
System.
|
IsExpandOnDblClickEnabled
Gets or sets a value whether the item will toggle its expand state on double click.
Declaration
[ScriptableMember]
public bool IsExpandOnDblClickEnabled { get; set; }
Property Value
System.
|
IsExpandOnSingleClickEnabled
Gets or sets a value indicating whether the item will toggle its expand state on single click.
Declaration
[ScriptableMember]
public bool IsExpandOnSingleClickEnabled { get; set; }
Property Value
System.
|
IsLineEnabled
Gets or sets a value indicating whether connecting lines are displayed.
Declaration
[ScriptableMember]
public bool IsLineEnabled { get; set; }
Property Value
System.
|
IsLoadOnDemandEnabled
Gets or sets a value indicating whether loading on demand is enabled.
Declaration
[ScriptableMember]
public bool IsLoadOnDemandEnabled { get; set; }
Property Value
System.
|
Remarks
When the value is set to true the expander visual will be visible even if the item
do no have children. When the expander visual is clicked, the Load
IsOptionElementsEnabled
Gets or sets a value indicating whether checkboxes/radio buttons are displayed besides the TreeViewItems.
Declaration
[ScriptableMember]
public bool IsOptionElementsEnabled { get; set; }
Property Value
System.
|
IsRootLinesEnabled
Gets or sets a value indicating whether lines are displayed next to root item.
Declaration
[ScriptableMember]
public bool IsRootLinesEnabled { get; set; }
Property Value
System.
|
IsSingleExpandPath
Gets a value indicating whether only one branch of the TreeView will be expanded.
Declaration
[ScriptableMember]
public bool IsSingleExpandPath { get; set; }
Property Value
System.
|
Remarks
The property closes all item that are not parents of the last expanded item.
IsTriStateMode
Gets or sets a value indicating whether tri state mode for the checkboxes in the option lists is enabled.
Declaration
[ScriptableMember]
public bool IsTriStateMode { get; set; }
Property Value
System.
|
Remarks
When the value is set to true the checked state of the item depends on the checked state of its child items. When the checked state of the item is changed - the child items state is also changed.
IsVirtualizing
Gets or sets a value indicating whether the TreeView should virtualize its items. Virtualization should be used only when the TreeView is data bound.
Declaration
public bool IsVirtualizing { get; set; }
Property Value
System.
|
Remarks
This is a CLR wrapper for the TreeViewPanel.IsVirtualizing property. It will only work if the ItemsPanel of the TreeViewItem is a TreeViewPanel.
ItemEditTemplate
Gets or sets the template that the items will display when edited.
Declaration
public DataTemplate ItemEditTemplate { get; set; }
Property Value
System. The item edit template. |
ItemEditTemplateSelector
Gets or sets the template selector that the items will use to select a template to display when edited.
Declaration
public DataTemplateSelector ItemEditTemplateSelector { get; set; }
Property Value
System. The item edit template selector. |
ItemsIndent
Gets or sets the distance that each tree item level will be indented.
Declaration
[ScriptableMember]
public int ItemsIndent { get; set; }
Property Value
System.
|
PathSeparator
Gets or sets the delimiter string that the tree item path uses.
Declaration
[ScriptableMember]
public string PathSeparator { get; set; }
Property Value
System.
|
Remarks
The tree item path contains of a set of tree item labels
separated by the PathSeparator delimiter strings.
The default return value is the backslash character ().
PerformSelectionOnMouseUp
Gets or sets a boolean value indicating whether the selection will be performed on mouse up.
Declaration
public bool PerformSelectionOnMouseUp { get; set; }
Property Value
System.
|
ScrollViewer
Gets the ScrollViewer control the is inside the RadTreeView.
Declaration
[ScriptableMember]
public ScrollViewer ScrollViewer { get; }
Property Value
System.
|
Remarks
Use the ScrollViewer.HorizontalScrollBarVisibility and ScrollViewer.VerticalScrollBarVisibility attached properties to set the visibility of the ScrollBars.
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
ms:ScrollViewer.HorizontalScrollBarVisibility="Visible"
ms:ScrollViewer.VerticalScrollBarVisibility="Visible"/>
SelectedContainer
Gets the TreeViewItem container that is currently selected. This is a dependency property.
Declaration
[ScriptableMember]
public RadTreeViewItem SelectedContainer { get; }
Property Value
SelectedItem
Gets or sets the item that is currently selected. This is a dependency property.
Declaration
[ScriptableMember]
public object SelectedItem { get; set; }
Property Value
System.
|
SelectedItems
Gets a collection containing the items that are currently selected.
Declaration
[ScriptableMember]
public ObservableCollection<object> SelectedItems { get; }
Property Value
System.
|
SelectedValue
Gets or sets the value of the SelectedItem, obtained by using SelectedValuePath.
Declaration
[ScriptableMember]
public object SelectedValue { get; }
Property Value
System.
|
SelectedValuePath
Gets or sets the path that is used to extract the SelectedValue from the SelectedItem.
Declaration
[ScriptableMember]
public string SelectedValuePath { get; set; }
Property Value
System.
|
SelectionMode
Gets or sets the selection mode.
Declaration
[ScriptableMember]
public SelectionMode SelectionMode { get; set; }
Property Value
System.
|
TextDropAfter
Gets or sets the text "Drop after" text of the drag preview.
Declaration
[ScriptableMember]
public string TextDropAfter { get; set; }
Property Value
System. The text drop after. |
TextDropBefore
Gets or sets the text "Drop before" text of the drag preview.
Declaration
[ScriptableMember]
public string TextDropBefore { get; set; }
Property Value
System. The text drop before. |
TextDropIn
Gets or sets the text for "Drop in" text of the drag preview.
Declaration
[ScriptableMember]
public string TextDropIn { get; set; }
Property Value
System. The text drop in. |
TextDropRoot
Gets or sets the text that appears when an item is dropped in an empty TreeView.
Declaration
[ScriptableMember]
public string TextDropRoot { get; set; }
Property Value
System. The text drop in. |
TextSearchMode
Gets or sets the text search mode. Specifies how Text
Declaration
public TextSearchMode TextSearchMode { get; set; }
Property Value
Text The text search mode. |
Methods
add_DragEnded(RadTreeViewDragEndedEventHandler)
Declaration
public void add_DragEnded(RadTreeViewDragEndedEventHandler value)
Parameters
add_DragOverTree(DragOverTreeEventHandler)
Declaration
public void add_DragOverTree(DragOverTreeEventHandler value)
Parameters
Drag
|
add_DragStarted(RadTreeViewDragEventHandler)
Declaration
public void add_DragStarted(RadTreeViewDragEventHandler value)
Parameters
add_EditCanceled(RadTreeViewItemEditedEventHandler)
Declaration
public void add_EditCanceled(RadTreeViewItemEditedEventHandler value)
Parameters
add_Edited(RadTreeViewItemEditedEventHandler)
Declaration
public void add_Edited(RadTreeViewItemEditedEventHandler value)
Parameters
add_EditStarted(RadTreeViewItemEditedEventHandler)
Declaration
public void add_EditStarted(RadTreeViewItemEditedEventHandler value)
Parameters
add_PreviewDragEnded(RadTreeViewDragEndedEventHandler)
Declaration
public void add_PreviewDragEnded(RadTreeViewDragEndedEventHandler value)
Parameters
add_PreviewDragStarted(RadTreeViewDragEventHandler)
Declaration
public void add_PreviewDragStarted(RadTreeViewDragEventHandler value)
Parameters
add_PreviewEditCanceled(RadTreeViewItemEditedEventHandler)
Declaration
public void add_PreviewEditCanceled(RadTreeViewItemEditedEventHandler value)
Parameters
add_PreviewEdited(RadTreeViewItemEditedEventHandler)
Declaration
public void add_PreviewEdited(RadTreeViewItemEditedEventHandler value)
Parameters
add_PreviewEditStarted(RadTreeViewItemEditedEventHandler)
Declaration
public void add_PreviewEditStarted(RadTreeViewItemEditedEventHandler value)
Parameters
AddItemByPath(String)
Creates a new item and adds a item by path. Can be used if the TreeView is not data bound.
Declaration
public RadTreeViewItem AddItemByPath(string path)
Parameters
System. Where the item should be added. |
Returns
Rad The new item if the operation is successful. |
AddItemByPath(String, String)
Creates a new item and adds a item by path. The label of the new item will be the text after the last separator.
Declaration
public RadTreeViewItem AddItemByPath(string path, string separator)
Parameters
System. Where the item should be added. |
System. The path separator. |
Returns
Rad The new item if the operation is successful. |
AddItemsByPath(String, String)
Adds an item at the given path, given that the TreeView is not bound.
Declaration
public RadTreeViewItem AddItemsByPath(string path, string separator)
Parameters
System. The path to create an item at. |
System. The path separator. |
Returns
Rad The newly created RadTreeViewItem. |
BringIndexIntoView(Int32)
Brings the item with the given index into view. The method will not work before the item containers have been generated.
Declaration
public void BringIndexIntoView(int index)
Parameters
System. The index of the item to be brought into view. |
BringIndexIntoView(Int32, Point)
Brings the item with the given index into view. The method will not work before the item containers have been generated.
Declaration
public void BringIndexIntoView(int index, Point offset)
Parameters
System. The index of the item to be brought into view. |
System. The offset to tree view top left corner where the item should be scrolled to. |
BringItemIntoView(Object)
Brings the given item into view. This is not a recursive method, it will only work for immediate items. The method will not work before the item containers have been generated.
Declaration
public void BringItemIntoView(object item)
Parameters
System. The item to be brought into view. |
BringItemIntoView(Object, Point)
Brings the given item into view. This is not a recursive method, it will only work for immediate items. The method will not work before the item containers have been generated.
Declaration
public void BringItemIntoView(object item, Point offset)
Parameters
System. The item to be brought into view. |
System. The offset to tree view top left corner where the item should be scrolled to. |
BringPathIntoView(String)
Brings an item into view. Works recursively for nested containers. If the Loaded event has not been fired yet the method will be scheduled for execution after the Loaded event. The method will realize the required containers if they are not yet created.
Declaration
public void BringPathIntoView(string path)
Parameters
System. The path of the item to be brought into view. |
BringPathIntoView(String, Point)
Brings an item into view. Works recursively for nested containers. If the Loaded event has not been fired yet the method will be scheduled for execution after the Loaded event. The method will realize the required containers if they are not yet created.
Declaration
public void BringPathIntoView(string path, Point offset)
Parameters
System. The path of the item to be brought into view. |
System. The offset from the top left corner of the tree where the item will be scrolled to. |
ChangeVisualState(Boolean)
Updates the visual state of the control.
Declaration
protected void ChangeVisualState(bool useTransitions)
Parameters
System.
|
ClearContainerForItemOverride(DependencyObject, Object)
Declaration
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameters
System.
|
System.
|
CollapseAll()
Collapses all items recursively.
Declaration
[ScriptableMember]
public void CollapseAll()
ContainerFromItemRecursive(Object)
Recursively searches the tree view in the tree to get an item container (RadTreeViewItem) for the particular data item.
Declaration
public RadTreeViewItem ContainerFromItemRecursive(object item)
Parameters
System.
|
Returns
CreateDragVisualContent(IList<Object>)
Creates default drag visual content - snapshot of all dragged items. Override this method in subclass in order to change the default drag visual content.
Declaration
protected virtual object CreateDragVisualContent(IList<object> draggedItems)
Parameters
System.
|
Returns
System.
|
ExpandAll()
Expands all items recursively.
Declaration
[ScriptableMember]
public void ExpandAll()
Remarks
If a child item is not generated it will be expanded once it is generated.
ExpandItemByPath(String)
Expands to an item with a given path.
Declaration
public void ExpandItemByPath(string path)
Parameters
System. The path to an item. |
ExpandItemByPath(String, String)
Expands to an item with a given path.
Declaration
public void ExpandItemByPath(string path, string separator)
Parameters
System. The path to an item. |
System. The separator for the path. |
GetContainerForItemOverride()
Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
System.
|
GetItemByPath(String)
Gets a item by specifying a path to it.
Declaration
public RadTreeViewItem GetItemByPath(string path)
Parameters
System. The path to the item. |
Returns
Rad The item if found. |
GetItemByPath(String, String)
Gets a item by specifying a path to it.
Declaration
public RadTreeViewItem GetItemByPath(string path, string separator)
Parameters
System. The path to the item. |
System. The path separator. |
Returns
Rad The item if found. |
HideBetweenItemsDragCue()
Hides the drag cue that appears when a drop between two items is possible.
Declaration
public void HideBetweenItemsDragCue()
IsItemItsOwnContainerOverride(Object)
Declaration
protected override bool IsItemItsOwnContainerOverride(object item)
Parameters
System.
|
Returns
System.
|
OnApplyTemplate()
Declaration
public override void OnApplyTemplate()
OnCreateAutomationPeer()
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
System.
|
OnDragEnded(RadTreeViewDragEndedEventArgs)
Raises the Drag
Declaration
protected virtual void OnDragEnded(RadTreeViewDragEndedEventArgs e)
Parameters
Rad The Rad |
OnDragEnter(DragEventArgs)
Called when DragEnter Event is Raise.
Declaration
protected override void OnDragEnter(DragEventArgs e)
Parameters
System. Event args. |
OnDragLeave(DragEventArgs)
Called when DragEnter Event is Raise.
Declaration
protected override void OnDragLeave(DragEventArgs e)
Parameters
System. Event args. |
OnDragOverTree(DragOverTreeEventArgs)
Raises the Drag
Declaration
protected virtual void OnDragOverTree(DragOverTreeEventArgs e)
Parameters
Drag The Drag |
OnDragStarted(RadTreeViewDragEventArgs)
Raises the Drag
Declaration
protected virtual void OnDragStarted(RadTreeViewDragEventArgs e)
Parameters
Rad The Rad |
OnDrop(DragEventArgs)
Called when DragEnter Event is Raise.
Declaration
protected override void OnDrop(DragEventArgs e)
Parameters
System. Event args. |
OnExpanderStyleChanged(Style, Style)
Propagates the changed expander style through tree's children. Called when the ExpanderStyleInherited property changes.
Declaration
protected virtual void OnExpanderStyleChanged(Style oldStyle, Style newStyle)
Parameters
System. The old style. |
System. The new style. |
OnGotFocus(Object, RoutedEventArgs)
Called when the TreeView or one of its items receive focus.
Declaration
protected virtual void OnGotFocus(object sender, RoutedEventArgs e)
Parameters
System. The sender of the event. |
System. The event arguments that will be passed to the GotFocus event. |
OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)
Declaration
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameters
System.
|
OnInitialized(EventArgs)
Declaration
protected override void OnInitialized(EventArgs e)
Parameters
System.
|
OnItemPrepared(RadTreeViewItemPreparedEventArgs)
Raises the Drag
Declaration
protected virtual void OnItemPrepared(RadTreeViewItemPreparedEventArgs e)
Parameters
Rad The Rad |
OnItemsChanged(NotifyCollectionChangedEventArgs)
Declaration
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
System.
|
OnLostFocus(Object, RoutedEventArgs)
Called when the TreeView or one of its items lose focus.
Declaration
protected virtual void OnLostFocus(object sender, RoutedEventArgs e)
Parameters
System. The sender of the event. |
System. The event arguments that are passed to the LostFocus event. |
OnLostKeyboardFocus(KeyboardFocusChangedEventArgs)
Declaration
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameters
System.
|
OnMouseLeftButtonDown(MouseButtonEventArgs)
Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
System.
|
OnMouseWheel(MouseWheelEventArgs)
Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
System.
|
OnPreviewDragEnded(RadTreeViewDragEndedEventArgs)
Raises the Preview
Declaration
protected virtual bool OnPreviewDragEnded(RadTreeViewDragEndedEventArgs e)
Parameters
Rad The Rad |
Returns
System.
|
OnPreviewDragStarted(RadTreeViewDragEventArgs)
Raises the Preview
Declaration
protected virtual bool OnPreviewDragStarted(RadTreeViewDragEventArgs e)
Parameters
Rad The Rad |
Returns
System.
|
OnPreviewSelectionChanged(SelectionChangedEventArgs)
This method is called when the PreviewSelectionChanged is raised.
Declaration
protected virtual bool OnPreviewSelectionChanged(SelectionChangedEventArgs e)
Parameters
System. The event arguments with which the event will be called. |
Returns
System. Returns whether the event was handled. |
Remarks
Not calling the base method in overrides means that the PreviewSelectionChanged event will not be raised.
OnSelectionChanged(SelectionChangedEventArgs)
Raises the Selection
Declaration
protected virtual void OnSelectionChanged(SelectionChangedEventArgs e)
Parameters
System. The SelectionChangedEventArgs instance containing the event data. |
OnTextInput(TextCompositionEventArgs)
Declaration
protected override void OnTextInput(TextCompositionEventArgs e)
Parameters
System.
|
PrepareContainerForItemOverride(DependencyObject, Object)
Declaration
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters
System.
|
System.
|
remove_DragEnded(RadTreeViewDragEndedEventHandler)
Declaration
public void remove_DragEnded(RadTreeViewDragEndedEventHandler value)
Parameters
remove_DragOverTree(DragOverTreeEventHandler)
Declaration
public void remove_DragOverTree(DragOverTreeEventHandler value)
Parameters
Drag
|
remove_DragStarted(RadTreeViewDragEventHandler)
Declaration
public void remove_DragStarted(RadTreeViewDragEventHandler value)
Parameters
remove_EditCanceled(RadTreeViewItemEditedEventHandler)
Declaration
public void remove_EditCanceled(RadTreeViewItemEditedEventHandler value)
Parameters
remove_Edited(RadTreeViewItemEditedEventHandler)
Declaration
public void remove_Edited(RadTreeViewItemEditedEventHandler value)
Parameters
remove_EditStarted(RadTreeViewItemEditedEventHandler)
Declaration
public void remove_EditStarted(RadTreeViewItemEditedEventHandler value)
Parameters
remove_PreviewDragEnded(RadTreeViewDragEndedEventHandler)
Declaration
public void remove_PreviewDragEnded(RadTreeViewDragEndedEventHandler value)
Parameters
remove_PreviewDragStarted(RadTreeViewDragEventHandler)
Declaration
public void remove_PreviewDragStarted(RadTreeViewDragEventHandler value)
Parameters
remove_PreviewEditCanceled(RadTreeViewItemEditedEventHandler)
Declaration
public void remove_PreviewEditCanceled(RadTreeViewItemEditedEventHandler value)
Parameters
remove_PreviewEdited(RadTreeViewItemEditedEventHandler)
Declaration
public void remove_PreviewEdited(RadTreeViewItemEditedEventHandler value)
Parameters
remove_PreviewEditStarted(RadTreeViewItemEditedEventHandler)
Declaration
public void remove_PreviewEditStarted(RadTreeViewItemEditedEventHandler value)
Parameters
ResetTheme()
Resets the theme.
Declaration
public void ResetTheme()
SelectItemByPath(String)
Adds the item with the given path to the collection of selected items. The path separator is "".
Declaration
public void SelectItemByPath(string path)
Parameters
System. A unique path for the item, normally made up of IDs. |
SelectItemByPath(String, String)
Adds the item with the given path to the collection of selected items. The path separator is "".
Declaration
public void SelectItemByPath(string path, string separator)
Parameters
System. A unique path for the item, normally made up of IDs. |
System. The string separating the path elements, for example "". |
ShowBetweenItemsDragCue(RadTreeViewItem)
Shows the DragCue that appears when a drop between two items is possible.
Declaration
public void ShowBetweenItemsDragCue(RadTreeViewItem dropDestination)
Parameters
Rad The relative drop position. In this method only DropPosition.Before and DropPosition.After make sense. |
UpdateDropPreviewLine(RadTreeViewItem, DropPosition)
Updates the drop preview line position and visibility while dragging.
Declaration
public void UpdateDropPreviewLine(RadTreeViewItem dropDestination, DropPosition dropPosition)
Parameters
Rad
|
Drop
|
Events
Checked
Occurs when a child TreeView item has been checked.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> Checked
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
Checked="RadTreeView1_Checked"/>
void RadTreeView1_Checked(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that has been checked
RadTreeViewItem checkedItem = e.Source as RadTreeViewItem;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
}
Collapsed
Occurs when a child TreeView item has been collapsed.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> Collapsed
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
Collapsed="RadTreeView1_Collapsed"/>
void RadTreeView1_Collapsed(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that has been collapsed
RadTreeViewItem collapsedItem = e.Source as RadTreeViewItem;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
}
DragEnded
Occurs when the drag has ended.
Declaration
[ScriptableMember]
public event RadTreeViewDragEndedEventHandler DragEnded
Event Type
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
DragEnded="RadTreeView1_DragEnded"/>
void private void RadTreeView1_DragEnded(object sender, RadTreeViewDragEventArgs e)
{
// get a reference to the items that has been dragged
Collection<object> draggedItems = e.DraggedItems;
}
DragOverTree
Occurs when the dragging over the tree view.
Declaration
[ScriptableMember]
public event DragOverTreeEventHandler DragOverTree
Event Type
DragStarted
Occurs when the drag has started.
Declaration
[ScriptableMember]
public event RadTreeViewDragEventHandler DragStarted
Event Type
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
DragStarted="RadTreeView1_DragStarted"/>
void private void RadTreeView1_DragStarted(object sender, RadTreeViewDragEventArgs e)
{
// get a reference to the items that has been dragged
Collection<object> draggedItems = e.DraggedItems;
}
EditCanceled
Raised when item editing has been canceled. This is a wrapper for the EditableHeaderedItemsControl.EditCanceled routed event.
Declaration
[ScriptableMember]
public event RadTreeViewItemEditedEventHandler EditCanceled
Event Type
Edited
Raised when the edit of an item has been committed.
Declaration
[ScriptableMember]
public event RadTreeViewItemEditedEventHandler Edited
Event Type
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
Edited="RadTreeView1_Edited"/>
void RadTreeView1_Edited(object sender, RadTreeViewItemEditedEventArgs e)
{
// get a reference to the item that has been edited
RadTreeViewItem editedItem = e.Source as RadTreeViewItem;
string newText = e.NewText;
string oldText = e.OldText;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
}
EditStarted
Raised when the edit of an item has just started. This is a wrapper for the EditableHeaderedItemsControl.EditStarted routed event.
Declaration
[ScriptableMember]
public event RadTreeViewItemEditedEventHandler EditStarted
Event Type
Expanded
Occurs when a child TreeView item has been expanded.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> Expanded
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
Expanded="RadTreeView1_Expanded"/>
void RadTreeView1_Expanded(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that has been expanded
RadTreeViewItem expandedItem = e.Source as RadTreeViewItem;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
}
ItemClick
Occurs when a child TreeView item has been clicked.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> ItemClick
Event Type
System.
|
ItemDoubleClick
Occurs when a child TreeView item has been double clicked.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> ItemDoubleClick
Event Type
System.
|
ItemPrepared
Occurs when a child RadTreeViewItem has been prepared and is ready for use.
Declaration
public event EventHandler<RadTreeViewItemPreparedEventArgs> ItemPrepared
Event Type
System.
|
Remarks
Use it to perform binding of RadTreeViewItem properties to the data objects.
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
ItemPrepared="RadTreeView1_ItemPrepared"/>
void RadTreeView1_ItemPrepared(object sender, RadTreeViewItemPreparedEventArgs e)
{
// get a reference to the item that has been selected
RadTreeViewItem preparedItem = e.PreparedItem as RadTreeViewItem;
// do something with this item
preparedItem.IsSelected = (preparedItem.Item is MyCustomBussinesObject);
}
LoadOnDemand
Occurs when a child TreeView item is loading its child items on demand. See the IsLoadOnDemandEnabled property.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> LoadOnDemand
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
LoadOnDemand="RadTreeView1_LoadOnDemand"/>
void RadTreeView1_LoadOnDemand(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that is loading on demand
RadTreeViewItem loadOnDemandItem = e.Source as RadTreeViewItem;
// get the data for the new items
// from web services or from another data set
// of just create them declaratively like that:
RadTreeViewItem newItem = new RadTreeViewItem();
newItem.Header = "New Item";
// add the new item(s) as a childs of the item that is loading on demand
loadOnDemandItem.Items.Add(newItem);
// if there are not items to add you can skip the loading animation
// by setting the IsLoadingOnDemand property to false
loadOnDemandItem.IsLoadingOnDemand = false;
// if there are no items to add at this moment and you want to
// stop the LoadOnDemand event from firing again set
loadOnDemandItem.IsLoadOnDemandEnabled = false;
}
PreviewChecked
Occurs before a child TreeView item is checked.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> PreviewChecked
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewChecked="RadTreeView1_PreviewChecked"/>
void private void RadTreeView1_PreviewChecked(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that will be checked
RadTreeViewItem itemToCheck = e.Source as RadTreeViewItem;
// if the action should be canceled set Handled property to true
e.Handled = true;
}
PreviewCollapsed
Occurs before a child TreeView item is collapsed.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> PreviewCollapsed
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewCollapsed="RadTreeView1_PreviewCollapsed"/>
void private void RadTreeView1_PreviewCollapsed(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that will be collapsed
RadTreeViewItem itemToCollapse = e.Source as RadTreeViewItem;
// if the action should be canceled set Handled property to true
e.Handled = true;
}
PreviewDragEnded
Occurs before the drag has been ended.
Declaration
[ScriptableMember]
public event RadTreeViewDragEndedEventHandler PreviewDragEnded
Event Type
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewDragEnded="RadTreeView1_PreviewDragEnded"/>
void private void RadTreeView1_PreviewDragEnded(object sender, RadTreeViewDragEventArgs e)
{
// get a reference to the items that has been dragged
Collection<object> draggedItems = e.DraggedItems;
}
PreviewDragStarted
Occurs before the drag is started.
Declaration
[ScriptableMember]
public event RadTreeViewDragEventHandler PreviewDragStarted
Event Type
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewDragStarted="RadTreeView1_PreviewDragStarted"/>
void private void RadTreeView1_PreviewDragStarted(object sender, RadTreeViewDragEventArgs e)
{
// get a reference to the items that has been dragged
Collection<object> draggedItems = e.DraggedItems;
// if the action should be canceled set Handled property to true
e.Handled = true;
}
PreviewEditCanceled
Raised just before item editing has been canceled. This is a wrapper for the EditableHeaderedItemsControl.PreviewEditCanceled routed event.
Declaration
[ScriptableMember]
public event RadTreeViewItemEditedEventHandler PreviewEditCanceled
Event Type
PreviewEdited
Occurs before a TreeView item to accept the new Edited data.
Declaration
[ScriptableMember]
public event RadTreeViewItemEditedEventHandler PreviewEdited
Event Type
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewEdited="RadTreeView1_PreviewEdited"/>
void private void RadTreeView1_PreviewEdited(object sender, RadTreeViewItemEditedEventArgs e)
{
// get a reference to the item that is being edited
RadTreeViewItem editedItem = e.Source as RadTreeViewItem;
string newText = e.NewText;
string oldText = e.OldText;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
// if the action should be canceled set Handled property to true
e.Handled = true;
}
PreviewEditStarted
Raised just before editing of an item has started. This is a wrapper for the EditableHeaderedItemsControl.PreviewEditStarted routed event.
Declaration
[ScriptableMember]
public event RadTreeViewItemEditedEventHandler PreviewEditStarted
Event Type
PreviewExpanded
Occurs before a child TreeView item is expanded.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> PreviewExpanded
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewExpanded="RadTreeView1_PreviewExpanded"/>
void private void RadTreeView1_PreviewExpanded(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that will be expanded
RadTreeViewItem itemToExpand = e.Source as RadTreeViewItem;
// if the action should be canceled set Handled property to true
e.Handled = true;
}
PreviewSelected
Occurs before a child tree view item is selected.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> PreviewSelected
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewSelected="RadTreeView1_PreviewSelected"/>
void private void RadTreeView1_PreviewSelected(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that will be selected
RadTreeViewItem itemToSelect = e.Source as RadTreeViewItem;
// if the action should be canceled set Handled property to true
e.Handled = true;
}
PreviewSelectionChanged
Raised just before the selected items collection has changed.
Declaration
[ScriptableMember]
public event SelectionChangedEventHandler PreviewSelectionChanged
Event Type
System.
|
PreviewUnchecked
Occurs before a child TreeView item is unchecked.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> PreviewUnchecked
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewUnchecked="RadTreeView1_PreviewUnchecked"/>
void private void RadTreeView1_PreviewUnchecked(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that will be unchecked
RadTreeViewItem itemToUncheck = e.Source as RadTreeViewItem;
// if the action should be canceled set Handled property to true
e.Handled = true;
}
PreviewUnselected
Occurs before a child tree view item is unselected.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> PreviewUnselected
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
PreviewUnselected="RadTreeView1_PreviewUnselected"/>
void private void RadTreeView1_PreviewUnselected(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that will be unselected
RadTreeViewItem itemToUnselect = e.Source as RadTreeViewItem;
// if the action should be canceled set Handled property to true
e.Handled = true;
}
Selected
Occurs when a child RadTreeView item has been selected.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> Selected
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
Selected="RadTreeView1_Selected"/>
void RadTreeView1_Selected(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that has been selected
RadTreeViewItem newSelectedItem = e.Source as RadTreeViewItem;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
// get a reference to the selected data item of the TreeView
object selectedItem = treeView.SelectedItem;
// get a reference to the selected item container of the Treeview
RadTreeViewItem selectedItemContainer = treeView.SelectedContainer;
}
SelectionChanged
Occurs after the value of the SelectedItems property of a tree is changed.
Declaration
[ScriptableMember]
public event SelectionChangedEventHandler SelectionChanged
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
SelectionChanged="RadTreeView1_SelectionChanged"/>
void RadTreeView1_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
// get a reference to the item that has been selected
RadTreeViewItem newSelectedItem = e.Source as RadTreeViewItem;
// get the list of the added items to selection
IList addedItems = e.AddedItems;
// get the list of the removed items from the selection
IList removedItems = e.RemovedItems;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
}
Unchecked
Occurs when a child TreeView item has been unchecked.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> Unchecked
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
Unchecked="RadTreeView1_Unchecked"/>
void RadTreeView1_Unchecked(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that has been unchecked
RadTreeViewItem uncheckedItem = e.Source as RadTreeViewItem;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
}
Unselected
Occurs when a child tree view item has been unselected.
Declaration
[ScriptableMember]
public event EventHandler<RadRoutedEventArgs> Unselected
Event Type
System.
|
Examples
Following code fragment shows the basic usage.
<telerik:RadTreeView
x:Name="RadTreeView1"
Unselected="RadTreeView1_Unselected"/>
void RadTreeView1_Unselected(object sender, RadRoutedEventArgs e)
{
// get a reference to the item that has been unselected
RadTreeViewItem unselectedItem = e.Source as RadTreeViewItem;
// get a reference to the RadTreeView
RadTreeView treeView = (sender as RadTreeView);
}
Explicit Interface Implementations
IScrollingInfo.ExtentHeight
Gets the height of the extent.
Declaration
double IScrollingInfo.ExtentHeight { get; }
Returns
System. The height of the extent. |
Implements
IScrollingInfo.ExtentWidth
Gets the width of the extent.
Declaration
double IScrollingInfo.ExtentWidth { get; }
Returns
System. The width of the extent. |
Implements
IScrollingInfo.HorizontalOffset
Gets the horizontal offset.
Declaration
double IScrollingInfo.HorizontalOffset { get; }
Returns
System. The horizontal offset. |
Implements
IScrollingInfo.TransformFromDropTargetToViewPort(Point)
Calculate the mouse position relative to the drop element.
Declaration
Point IScrollingInfo.TransformFromDropTargetToViewPort(Point positionInDropTarget)
Parameters
System. DragDrop related data. |
Returns
System. Relative DragPoint. |
Implements
IScrollingInfo.VerticalOffset
Gets the vertical offset.
Declaration
double IScrollingInfo.VerticalOffset { get; }
Returns
System. The vertical offset. |
Implements
IScrollingInfo.ViewportHeight
Gets the height of the viewport.
Declaration
double IScrollingInfo.ViewportHeight { get; }
Returns
System. The height of the viewport. |
Implements
IScrollingInfo.ViewportWidth
Gets the width of the viewport.
Declaration
double IScrollingInfo.ViewportWidth { get; }
Returns
System. The width of the viewport. |
Implements
IScrollingServiceCore.ScrollHorizontal(Double)
Scrolls the horizontal to the given offset.
Declaration
void IScrollingServiceCore.ScrollHorizontal(double offsetX)
Parameters
System. The offset X. |
Implements
IScrollingServiceCore.ScrollVertical(Double)
Scrolls the vertical to the given offset.
Declaration
void IScrollingServiceCore.ScrollVertical(double offsetY)
Parameters
System. The offset Y. |