BinaryTreeListViewItem
One row of a BinaryTreeListView: its cells, its expander and the rows beneath it.
public class BinaryTreeListViewItem : TreeViewItem
Inherits from / implements: TreeViewItem
Remarks
A bound tree creates its rows itself, one for each item, and you seldom meet this class
except in BinaryTreeListView.MultiSelectedItems. To build a tree in code, create
one for each row: put the row object – any object with the properties the columns bind to – in
HeaderedItemsControl.Header, and add the rows beneath it to
ItemsControl.Items.
Everything a TreeViewItem offers works here:
TreeViewItem.IsExpanded, TreeViewItem.IsSelected,
TreeViewItem.ExpandSubtree, FrameworkElement.ToolTip and the rest.
Examples
BinaryTreeListViewItem europe = new BinaryTreeListViewItem
{
Header = new Region { Name = "Europe", Revenue = 4200000m },
IsExpanded = true,
ToolTip = "Revenue for the year to date"
};
europe.Items.Add(new BinaryTreeListViewItem { Header = new Region { Name = "France", Revenue = 1300000m } });
europe.Items.Add(new BinaryTreeListViewItem { Header = new Region { Name = "Germany", Revenue = 1900000m } });
regionsTree.Items.Add(europe);See also
Members at a glance
| Properties | |
|---|---|
Level | Gets how deep in the tree this row is. |
| Methods | |
GetContainerForItemOverride | Creates the row that shows one bound child item: a BinaryTreeListViewItem. |
IsItemItsOwnContainerOverride | Tells the row whether a child item is already a row, and so needs no row of its own. |
OnItemsChanged | Redraws this row and every row beneath it when its children change, because a row's connecting lines depend on whether another row follows it at its own level and at each level above. |
Properties
Level
Gets how deep in the tree this row is.
- Value
- 0 for a top-level row, 1 for its children, 2 for theirs, and so on.
Remarks
The level is worked out the first time it is read, from the row's place in the tree, and remembered.
Methods
GetContainerForItemOverride
Creates the row that shows one bound child item: a BinaryTreeListViewItem.
Returns
A new, empty BinaryTreeListViewItem.
IsItemItsOwnContainerOverride
Tells the row whether a child item is already a row, and so needs no row of its own.
Parameters
item- An entry in this row's
ItemsControl.Items.
Returns
true when item is a
BinaryTreeListViewItem.
OnItemsChanged
Redraws this row and every row beneath it when its children change, because a row's connecting lines depend on whether another row follows it at its own level and at each level above.
Parameters
e- What changed in the collection.
Remarks
A derived class that overrides this should call the base implementation.