Silverlight Tree Control
The Tree control exposes several properties for controlling various aspects of the tree and its behaviour.
Properties for Liquid.Tree
Below are the available properties complete with descriptions.
VerticalScrollBarVisibility (ScrollBarVisibility)
Gets or sets the visibility of the vertical scrollbar.
HorizontalScrollBarVisibility (ScrollBarVisibility)
Gets or sets the visibility of the horizontal scrollbar.
ApplyCheckChangesToChildren (Boolean)
Gets or set whether checking a node will cause its chidren to become checked too.
MaxTitleLength (Int32)
Gets or sets the number of characters allowed in the node title.
TitlePostfix (String)
Gets or sets the character string to be appended to the title when its length is more than the MaxTitleLength property.
Nodes (ObservableCollection`1)
Gets or sets a collection of root nodes.
NodeHeight (Double)
Gets or sets the height of a node.
NumberOfTicksToExpandOnHover (Int32)
Gets or sets when drag and drop is enabled this is the number of timer ticks before the node under the cursor will automatically expand.
EnableDragAndDrop (Boolean)
Gets or sets whether dragging and dropping is enabled.
EnableNodeEditing (Boolean)
Gets or sets whether node title text can be edited.
EnableMultiSelect (Boolean)
Gets or sets whether you can select more than one node using CTRL and SHIFT.
ChildrenInheritCheckboxVisibility (Boolean)
Gets or sets whether child checkbox visibility setting is taken from it's parent (Tree).
EnableLines (Boolean)
Gets or sets whether connecting lines are enabled.
EnableCheckboxes (Boolean)
Gets or sets whether checkboxes should be displayed next to each node.
EnablePartialCheckboxChecks (Boolean)
Gets or sets whether checkboxes can be in a state of not checked and not clear.
Selected (Node)
Gets or sets the currently selected node.
SelectedItems (List`1)
Gets the currently selected item list.
Methods for Liquid.Tree
Below are the available methods, complete with parameters and descriptions.
Sort(SortActions)
Sorts the child nodes by the node title.
Sort(Boolean, Comparison<Node>)
Sorts the child nodes by the node title.
Parameters
sortAll
Indicates whether child nodes should be sorted as well
comparer
The sort compare method
Find(String)
Iterates through all child nodes looking for a node with the provided terms in the title text.
Parameters
Returns: Matching collection of nodes
Get(String)
Iterates through all child nodes looking for a node with the matching ID.
Parameters
Returns: A matching Node or null
BulkUpdateBegin()
You can call this method when adding large numbers of child nodes, this significantly increases performance
you must call BulkInsertEnd() when you have finished adding nodes.
BulkUpdateEnd()
This method must be called when you have finished adding nodes and have previously called BulkInsertBegin().
DisableChildUpdates()
Disables updates to the child node collection.
EnableChildUpdates()
This method must be called when you have finished adding nodes and have previously called BulkInsertBegin().
BuildRoot()
Build's the root element of the tree.
Clear()
Removes all child nodes from the tree.
ClearAllChecked()
Clears the current and all child node checked state.
GetAllChecked()
Gets all checked nodes.
Parameters
ExpandAll()
Expands all nodes.
CollapseAll()
Collapses all nodes.
GetNodes(Node, Node)
Gets a list of nodes between two specified nodes using the current view of the tree.
Parameters
Returns: The Start Node through to the End Node
SetSelected(List<Node>)
Selects a group of nodes.
Parameters
SetSelected(Node)
Sets the selected node.
Parameters
ClearSelected()
De-selects the selected nodes.
SelectPrevious()
Selects the node immediately before the currently selected node.
SelectNext()
Selects the node after the selected node.
ScrollIntoPosition()
Scrolls the selected node into view if it is not visible in the ScrollViewer.
GetNodeAtPoint(Point)
Gets the node at the supplied point.
Parameters
Returns: Node at the position or null for no node
ScrollIntoPosition(Double, Double, Double, Double)
Scrolls the area control into position.
Parameters
width
Width of the area that must be in view
height
Height of the area that must be in view
OnApplyTemplate()
This is called when the template has been bound to the control.
TreeEventArgs Properties
When the Tree Control raises an event, the argument provided is a TreeEventArgs object whose properties are expalined below:
| Type |
Name |
Description |
| int |
ID |
ID for the node that generated the event. |
| Node |
Source |
When dragging and dropping, this contains the node being dragged. |
| Node |
Target |
When dragging and dropping, this contains the node . |
| bool |
Cancel |
Allows an operation such as a drag and drop to be cancelled. |
| Tree.DropActions |
DropAction |
For the drop event only, this can be set to control the drop action. Possible settings are: AppendAsChild, InsertBefore, InsertAfter. |