Like most Silverlight controls, the RadTreeView also allows you to template it in order to change the control from the inside. Except for templating the whole control, you can template parts of it or even independent controls related to it. This topic will make you familiar with the:
|For more information about templating and how to modify the default templates of the RadControls read the common topics on this matter.|
RadTreeView Template Structure
This section will explain the structure of the RadTreeView 's template. Here is a snapshot of the template generated in Expression Blend.
It contains the following parts:
- RootElement - is of type Grid and represents the layout root for the template.
- [Border] - hosts the RadTreeView items and is of type Border.
- [Grid] - represents the host control for the RadTreeView's items.
- ScrollViewer - is of type ScrollViewer element and represents the control that holds all the items.
- [ItemsPresenter] - this is the only mandatory element from the RadTreeView template used to display the RadTreeView items.
- DragBetweenItemsFeedback - is of type FrameworkElement and represents the indicator which is displayed when the item that is dragged will be dropped between two items.
- Ellipse - is the circle drawn in the most left part of that indicator.
- Rectangle - is the line drawn from the circle to the end of the whole item.
RadTreeViewItem Template Structure
- Root Element - is of type Grid and represents the layout root for the template.
- HeaderRow - is of type Grid and contains the header parts of the item.
- [Border] - hosts the item's header and is of type Border.
- MouseOverVisual - is of type Border and represents the mouse over state of the item - the outer border around the item when the mouse is over it.
- [Border] - is of type Border and represents the inner border of the item whan the mouse is located over it.
- SelectionUnfocusedVisual - is of type Border and represents the visual used for the selected unfocused state of the Item. This is the state when the item is selected, but the RadTreeView is not focused.
- [Border] - represents the item's inner border while it is in the selected unfocused state.
- SelectionVisual - is of type Border and represents the visual used for the selected focused state of the item.
- [Border] - represents the inner border of an item in the selected focused state.
- IndentContainer - is of type StackPanel and contains the indentation for the Item.
- IndentFirstVerticalLine - is of type Rectangle and represents...
- ListRootContainer -
- HorizontalLine - is of type Rectangle and is used when creating the line of the RadTreeView. See IsLineEnabled property here.
- VerticalLine - is of type Rectangle and is used when creating the line of the RadTreeView. See IsLineEnabled property here.
- Expander - is of type ToggleButton and represents the element used for collapse/expand of the item. You can set the style of the element by using the ExpanderStyle property of the RadTreeView, read more here.
- LoadingVisual - is container for the loading animation elements. It is of type Grid and hosts two paths.
- [Path] - is a path in the form of not full circle.
- [Path] - is of type Path and represents the arrow.
- CheckBoxElement - if of type CheckBox and when visible is shown next to the Expander element.
- RadioButtonElement - if of type RadioButton and when visible is shown next to the Expander element
- Image - the image used to display the current state. State images are declared by the DefaultImageSrc, SelectedImageSrc and ExpandedImageSrc properties, read more here.
- FocusVisual - is of type FrameworkElement and represents the visual used for the focused state of the item.
- Grid - hosts the header of the item.
- Header - is of type ContentPresenter and also represents a control part used to display the header of the Item.
- EditHeaderElement - is also a control part of type ContentPresenter used to edit the header of the Item.
- ItemsHost - is of type ItemsPresenter and represents the child items of the Item.