Class BinaryTreeListView
A custom TreeView derived class that renders and manages its data in several columns, each column's row being rendered in an hierarchical manner.
Namespace: Binarymission.WPF.Controls.TreeControls
Assembly: Binarymission.WPF.Controls.BinaryTreeListView.dll
Syntax
public class BinaryTreeListView : TreeView
Remarks
The control is very simple to use. All that you will need to do typically is:
- Create an instance of BinaryTreeListView control.
- Create as many needed instances of GridViewColumns.
- Set the
property with the data-source that will feed the data for this control.
This can come from any sources like: XML, CLR objects/collections, result of LINQ queries, DataTable, simple CLR arrays, etc.
- Specify which column you would like the control to render as a tree-list column. TO do this set the TreeListViewColumnIndex or TreeListViewColumn properties with relevant value.
Note that you can also add rows pro grammatically. It is not a necessity that the data comes from DataBinding / data-source.
That is all to it. Run the application and you will see your data in a hierarchical manner using a TreeListView style.
You could also setup other properties in the control to enhance the user experience.
Constructors
BinaryTreeListView()
Initializes a new instance of the BinaryTreeListView class.
Declaration
public BinaryTreeListView()
Properties
CollapseButtonImage
Gets or sets the collapse button image.
Declaration
public ImageSource CollapseButtonImage { get; set; }
Columns
Gets the columns collection in the control.
Declaration
public GridViewColumnCollection Columns { get; }
ExpandButtonImage
Gets or sets the expand button image.
Declaration
public ImageSource ExpandButtonImage { get; set; }
ExpandCollapseBorderBrush
Gets or sets the expand / collapse border brush.
Declaration
public Brush ExpandCollapseBorderBrush { get; set; }
ExpandCollapseButtonImageStretch
Gets or sets the expand collapse button image stretch.
Declaration
public Stretch ExpandCollapseButtonImageStretch { get; set; }
ExpandCollapseControlFillBrush
Gets or sets the expand / collapse glyph fill brush.
Declaration
public Brush ExpandCollapseControlFillBrush { get; set; }
ExpandCollapsePlusMinusBrush
Gets or sets the expand / collapse plus / minus brush.
Declaration
public Brush ExpandCollapsePlusMinusBrush { get; set; }
IsMultiSelectionEnabled
Gets or sets whether multi-selection of notes is enabled.
Declaration
public bool IsMultiSelectionEnabled { get; set; }
Remarks
By default, CTRL + click based multi-selection is enabled if you set this property to true.If you also need Shift + Selection for multi-selection, then please set IsShiftMultiSelectionEnabled to True.
IsNodesConnectingLineVisible
Gets or sets a value indicating whether the control should draw the nodes connecting line.
Declaration
public bool IsNodesConnectingLineVisible { get; set; }
IsShiftMultiSelectionEnabled
Gets or sets whether the SHIFT + selection is enabled for multi-selection of nodes. By default this value is false.
Declaration
public bool IsShiftMultiSelectionEnabled { get; set; }
MultiSelectedItems
Gets the multi-selected items.
Declaration
public List<BinaryTreeListViewItem> MultiSelectedItems { get; }
NodesConnectingLineBrush
Gets or sets the nodes connecting line brush.
Declaration
public SolidColorBrush NodesConnectingLineBrush { get; set; }
RenderCollapseExpandVisualAlwaysInTheFirstColumn
Gets or sets a value indicating whether to always render the first column as the tree-list view colum.
Declaration
public bool RenderCollapseExpandVisualAlwaysInTheFirstColumn { get; set; }
SelectionBackgroundBrush
Gets or sets the node/row item "selection" background brush.
Declaration
public Brush SelectionBackgroundBrush { get; set; }
SelectionForegroundBrush
Gets or sets the node/row item "selection" foreground brush.
Declaration
public Brush SelectionForegroundBrush { get; set; }
TreeListViewColumn
Gets or sets the column object that will be rendered as a treelistview column - i.e. the column that will be able to expand/collapse its child nodes.
Declaration
public GridViewColumn TreeListViewColumn { get; set; }
TreeListViewColumnIndex
Gets or sets the column index that will be rendered as a treelistview column - i.e. the column that will be able to expand/collapse its child nodes.
Declaration
public int TreeListViewColumnIndex { get; set; }
TreeListViewItemIsRenderedWithRoundedCorner
Gets or sets a value indicating whether the tree list view item is rendered with rounded corner.
Declaration
public bool TreeListViewItemIsRenderedWithRoundedCorner { get; set; }
Methods
CollapseAllNodes()
Collapses all nodes.
Declaration
public void CollapseAllNodes()
ExpandAllNodes(Boolean)
Expands all nodes.
Declaration
public void ExpandAllNodes(bool shouldScrollBackToTop)
Parameters
Type | Name | Description |
---|---|---|
Boolean | shouldScrollBackToTop | if set to |
ExpandNodeByIndex(Int32)
Expands the index of the node by.
Declaration
public void ExpandNodeByIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
ExpandNodesByIndices(IEnumerable<Int32>)
Expands the nodes by indices.
Declaration
public void ExpandNodesByIndices(IEnumerable<int> indices)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Int32> | indices | The indices. |
GetContainerForItemOverride()
Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
Type | Description |
---|---|
DependencyObject |
IsItemItsOwnContainerOverride(Object)
Declaration
protected override bool IsItemItsOwnContainerOverride(object item)
Parameters
Type | Name | Description |
---|---|---|
Object | item |
Returns
Type | Description |
---|---|
Boolean |
OnItemsChanged(NotifyCollectionChangedEventArgs)
Declaration
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
NotifyCollectionChangedEventArgs | e |
SelectNodeByIndex(Int32)
Selects the index of the node by.
Declaration
public void SelectNodeByIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
SelectNodesByIndices(IEnumerable<Int32>)
Declaration
public void SelectNodesByIndices(IEnumerable<int> indices)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Int32> | indices |