Class TreeViewBuilder
Inheritance
System.Object
TreeViewBuilder
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Syncfusion.EJ2.dll
Syntax
public class TreeViewBuilder : ControlBuilder
Constructors
TreeViewBuilder()
Declaration
TreeViewBuilder(TreeView)
Declaration
public TreeViewBuilder(TreeView model)
Parameters
Fields
model
Declaration
Field Value
Properties
HtmlAttr
Declaration
public IDictionary<string, object> HtmlAttr { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.IDictionary<System.String, System.Object> |
|
ID
Declaration
public string ID { get; set; }
Property Value
Type |
Description |
System.String |
|
Output
Declaration
public override TextWriter Output { get; set; }
Property Value
Type |
Description |
System.IO.TextWriter |
|
Overrides
Methods
ActionFailure(String)
Event callback that is raised while any TreeView action failed to fetch the desired results.
Declaration
public TreeViewBuilder ActionFailure(string actionFailure)
Parameters
Type |
Name |
Description |
System.String |
actionFailure |
|
Returns
AllowDragAndDrop(Boolean)
Indicates whether the TreeView allows drag and drop of nodes. To drag and drop a node in
desktop, hold the mouse on the node, drag it to the target node and drop the node by releasing
the mouse. For touch devices, drag and drop operation is performed by touch, touch move
and touch end. For more information on drag and drop nodes concept, refer to
Drag and Drop.
Declaration
public TreeViewBuilder AllowDragAndDrop(bool allowDragAndDrop = true)
Parameters
Type |
Name |
Description |
System.Boolean |
allowDragAndDrop |
|
Returns
AllowEditing(Boolean)
Enables or disables editing of the text in the TreeView node. When allowEditing
property is set
to true, the TreeView allows you to edit the node by double clicking the node or by navigating to
the node and pressing F2 key. For more information on node editing, refer
to Node Editing.
Declaration
public TreeViewBuilder AllowEditing(bool allowEditing = true)
Parameters
Type |
Name |
Description |
System.Boolean |
allowEditing |
|
Returns
AllowMultiSelection(Boolean)
Enables or disables multi-selection of nodes. To select multiple nodes:
Select the nodes by holding down the Ctrl key while clicking on the nodes.
Select consecutive nodes by clicking the first node to select and hold down the Shift key
and click the last node to select.
Declaration
public TreeViewBuilder AllowMultiSelection(bool allowMultiSelection = true)
Parameters
Type |
Name |
Description |
System.Boolean |
allowMultiSelection |
|
Returns
AllowTextWrap(Boolean)
Enables or disables text wrapping when text exceeds the bounds in the TreeView node.
When the allowTextWrap property is set to true, the TreeView node text content will wrap to the next line
when it exceeds the width of the TreeView node.
The TreeView node height will be adjusted automatically based on the TreeView node content.
Declaration
public TreeViewBuilder AllowTextWrap(bool allowTextWrap = true)
Parameters
Type |
Name |
Description |
System.Boolean |
allowTextWrap |
|
Returns
Animation(TreeViewNodeAnimationSettings)
Specifies the type of animation applied on expanding and collapsing the nodes along with duration.
Declaration
public TreeViewBuilder Animation(TreeViewNodeAnimationSettings animation)
Parameters
Returns
Animation(Action<TreeViewNodeAnimationSettingsBuilder>)
Declaration
public TreeViewBuilder Animation(Action<TreeViewNodeAnimationSettingsBuilder> animation)
Parameters
Returns
AutoCheck(Boolean)
Allow us to specify the parent and child nodes to get auto check while we check or uncheck a node.
Declaration
public TreeViewBuilder AutoCheck(bool autoCheck = true)
Parameters
Type |
Name |
Description |
System.Boolean |
autoCheck |
|
Returns
CheckedNodes(String[])
The checkedNodes
property is used to set the nodes that need to be checked.
This property returns the checked nodes ID in the TreeView component.
The checkedNodes
property depends upon the value of showCheckBox
property.
For more information on checkedNodes, refer to
checkedNodes.
Declaration
public TreeViewBuilder CheckedNodes(string[] checkedNodes)
Parameters
Type |
Name |
Description |
System.String[] |
checkedNodes |
|
Returns
Created(String)
Event callback that is raised when the TreeView component is created successfully.
Declaration
public TreeViewBuilder Created(string created)
Parameters
Type |
Name |
Description |
System.String |
created |
|
Returns
CssClass(String)
Specifies one or more than one CSS classes to be added with root element of the TreeView to help customize the appearance of the component.
Declaration
public TreeViewBuilder CssClass(string cssClass)
Parameters
Type |
Name |
Description |
System.String |
cssClass |
|
Returns
DataBound(String)
Event callback that is raised when data source is populated in the TreeView.
Declaration
public TreeViewBuilder DataBound(string dataBound)
Parameters
Type |
Name |
Description |
System.String |
dataBound |
|
Returns
DataSourceChanged(String)
Event callback that is raised when data source is changed in the TreeView. The data source will be changed after performing some operation like
drag and drop, node editing, adding and removing node.
Declaration
public TreeViewBuilder DataSourceChanged(string dataSourceChanged)
Parameters
Type |
Name |
Description |
System.String |
dataSourceChanged |
|
Returns
Destroyed(String)
Event callback that is raised when the TreeView control is destroyed successfully.
Declaration
public TreeViewBuilder Destroyed(string destroyed)
Parameters
Type |
Name |
Description |
System.String |
destroyed |
|
Returns
Disabled(Boolean)
Specifies a value that indicates whether the TreeView component is disabled or not.
When set to true, user interaction will not be occurred in TreeView.
Declaration
public TreeViewBuilder Disabled(bool disabled = true)
Parameters
Type |
Name |
Description |
System.Boolean |
disabled |
|
Returns
DragArea(String)
Specifies the target in which the draggable element can be moved and dropped.
By default, the draggable element movement occurs in the page.
Declaration
public TreeViewBuilder DragArea(string dragArea)
Parameters
Type |
Name |
Description |
System.String |
dragArea |
|
Returns
DrawNode(String)
Event callback that is raised before the TreeView node is appended to the TreeView element. It helps to customize specific nodes.
Declaration
public TreeViewBuilder DrawNode(string drawNode)
Parameters
Type |
Name |
Description |
System.String |
drawNode |
|
Returns
EnableHtmlSanitizer(Boolean)
Specifies whether to allow rendering of untrusted HTML values in the TreeView component.
While enable this property, it sanitize suspected untrusted strings and script, and update in the TreeView component.
Declaration
public TreeViewBuilder EnableHtmlSanitizer(bool enableHtmlSanitizer = true)
Parameters
Type |
Name |
Description |
System.Boolean |
enableHtmlSanitizer |
|
Returns
EnablePersistence(Boolean)
Enables or disables persisting TreeView state between page reloads. If enabled, following APIs will persist.
selectedNodes
- Represents the nodes that are selected in the TreeView component.
checkedNodes
- Represents the nodes that are checked in the TreeView component.
expandedNodes
- Represents the nodes that are expanded in the TreeView component.
Declaration
public TreeViewBuilder EnablePersistence(bool enablePersistence = true)
Parameters
Type |
Name |
Description |
System.Boolean |
enablePersistence |
|
Returns
EnableRtl(Boolean)
Enable or disable rendering component in right to left direction.
Declaration
public TreeViewBuilder EnableRtl(bool enableRtl = true)
Parameters
Type |
Name |
Description |
System.Boolean |
enableRtl |
|
Returns
ExpandedNodes(String[])
Represents the expanded nodes in the TreeView component. We can set the nodes that need to be
expanded or get the ID of the nodes that are currently expanded by using this property.
Declaration
public TreeViewBuilder ExpandedNodes(string[] expandedNodes)
Parameters
Type |
Name |
Description |
System.String[] |
expandedNodes |
|
Returns
ExpandOn(ExpandOnSettings)
Specifies the action on which the node expands or collapses.
The available actions :
Click
- The expand/collapse operation happens when you single-click on the node in desktop.
DblClick
- The expand/collapse operation happens when you double-click on the node in desktop.
None
- The expand/collapse operation will not happen.
In mobile devices, the node expand/collapse action happens on single tap.
Here ExpandOn attribute is set to single click property also can use double click and none property.
Declaration
public TreeViewBuilder ExpandOn(ExpandOnSettings expandOn)
Parameters
Returns
Fields(TreeViewFieldsSettings)
Specifies the data source and mapping fields to render TreeView nodes.
Declaration
public TreeViewBuilder Fields(TreeViewFieldsSettings fields)
Parameters
Returns
Fields(Action<TreeViewFieldsSettingsBuilder>)
Declaration
public TreeViewBuilder Fields(Action<TreeViewFieldsSettingsBuilder> fields)
Parameters
Returns
FullRowNavigable(Boolean)
If this property is set to true, then the entire TreeView node will be navigate-able instead of text element.
Declaration
public TreeViewBuilder FullRowNavigable(bool fullRowNavigable = true)
Parameters
Type |
Name |
Description |
System.Boolean |
fullRowNavigable |
|
Returns
FullRowSelect(Boolean)
On enabling this property, the entire row of the TreeView node gets selected by clicking a node.
When disabled only the corresponding node's text gets selected.
For more information on Fields concept, refer to
Fields.
Declaration
public TreeViewBuilder FullRowSelect(bool fullRowSelect = true)
Parameters
Type |
Name |
Description |
System.Boolean |
fullRowSelect |
|
Returns
HtmlAttributes(Object)
Allows additional HTML attributes such as title, name, etc., and
accepts n number of attributes in a key-value pair format.
Declaration
public TreeViewBuilder HtmlAttributes(object htmlAttributes)
Parameters
Type |
Name |
Description |
System.Object |
htmlAttributes |
|
Returns
KeyPress(String)
Event callback that is raised when key press is successful. It helps to customize the operations at key press.
Declaration
public TreeViewBuilder KeyPress(string keyPress)
Parameters
Type |
Name |
Description |
System.String |
keyPress |
|
Returns
LoadOnDemand(Boolean)
By default, the load on demand (Lazy load) is set to true. By disabling this property, all the tree nodes are rendered at the
beginning itself.
Declaration
public TreeViewBuilder LoadOnDemand(bool loadOnDemand = true)
Parameters
Type |
Name |
Description |
System.Boolean |
loadOnDemand |
|
Returns
NodeChecked(String)
Event callback that is raised when the TreeView node is checked/unchecked successfully.
Declaration
public TreeViewBuilder NodeChecked(string nodeChecked)
Parameters
Type |
Name |
Description |
System.String |
nodeChecked |
|
Returns
NodeChecking(String)
Event callback that is raised before the TreeView node is to be checked/unchecked.
Declaration
public TreeViewBuilder NodeChecking(string nodeChecking)
Parameters
Type |
Name |
Description |
System.String |
nodeChecking |
|
Returns
NodeClicked(String)
Event callback that is raised when the TreeView node is clicked successfully.
Declaration
public TreeViewBuilder NodeClicked(string nodeClicked)
Parameters
Type |
Name |
Description |
System.String |
nodeClicked |
|
Returns
NodeCollapsed(String)
Event callback that is raised when the TreeView node collapses successfully.
Declaration
public TreeViewBuilder NodeCollapsed(string nodeCollapsed)
Parameters
Type |
Name |
Description |
System.String |
nodeCollapsed |
|
Returns
NodeCollapsing(String)
Event callback that is raised before the TreeView node collapses.
Declaration
public TreeViewBuilder NodeCollapsing(string nodeCollapsing)
Parameters
Type |
Name |
Description |
System.String |
nodeCollapsing |
|
Returns
NodeDragging(String)
Event callback that is raised when the TreeView node is dragged (moved) continuously.
Declaration
public TreeViewBuilder NodeDragging(string nodeDragging)
Parameters
Type |
Name |
Description |
System.String |
nodeDragging |
|
Returns
NodeDragStart(String)
Event callback that is raised when the TreeView node drag (move) starts.
Declaration
public TreeViewBuilder NodeDragStart(string nodeDragStart)
Parameters
Type |
Name |
Description |
System.String |
nodeDragStart |
|
Returns
NodeDragStop(String)
Event callback that is raised when the TreeView node drag (move) is stopped.
Declaration
public TreeViewBuilder NodeDragStop(string nodeDragStop)
Parameters
Type |
Name |
Description |
System.String |
nodeDragStop |
|
Returns
NodeDropped(String)
Event callback that is raised when the TreeView node is dropped on target element successfully.
Declaration
public TreeViewBuilder NodeDropped(string nodeDropped)
Parameters
Type |
Name |
Description |
System.String |
nodeDropped |
|
Returns
NodeEdited(String)
Event callback that is raised when the TreeView node is renamed successfully.
Declaration
public TreeViewBuilder NodeEdited(string nodeEdited)
Parameters
Type |
Name |
Description |
System.String |
nodeEdited |
|
Returns
NodeEditing(String)
Event callback that is raised before the TreeView node is renamed.
Declaration
public TreeViewBuilder NodeEditing(string nodeEditing)
Parameters
Type |
Name |
Description |
System.String |
nodeEditing |
|
Returns
NodeExpanded(String)
Event callback that is raised when the TreeView node expands successfully.
Declaration
public TreeViewBuilder NodeExpanded(string nodeExpanded)
Parameters
Type |
Name |
Description |
System.String |
nodeExpanded |
|
Returns
NodeExpanding(String)
Event callback that is raised before the TreeView node is to be expanded.
Declaration
public TreeViewBuilder NodeExpanding(string nodeExpanding)
Parameters
Type |
Name |
Description |
System.String |
nodeExpanding |
|
Returns
NodeSelected(String)
Event callback that is raised when the TreeView node is selected/unselected successfully.
Declaration
public TreeViewBuilder NodeSelected(string nodeSelected)
Parameters
Type |
Name |
Description |
System.String |
nodeSelected |
|
Returns
NodeSelecting(String)
Event callback that is raised before the TreeView node is selected/unselected.
Declaration
public TreeViewBuilder NodeSelecting(string nodeSelecting)
Parameters
Type |
Name |
Description |
System.String |
nodeSelecting |
|
Returns
NodeTemplate(String)
Specifies a template to render customized content for all the nodes. If the nodeTemplate
property
is set, the template content overrides the displayed node text. The property accepts template string
template string
or HTML element ID holding the content. For more information on template concept, refer to
Template.
Declaration
public TreeViewBuilder NodeTemplate(string nodeTemplate)
Parameters
Type |
Name |
Description |
System.String |
nodeTemplate |
|
Returns
Render()
Declaration
public HtmlString Render()
Returns
Type |
Description |
System.Web.HtmlString |
|
SelectedNodes(String[])
Represents the selected nodes in the TreeView component. We can set the nodes that need to be
selected or get the ID of the nodes that are currently selected by using this property.
On enabling allowMultiSelection
property we can select multiple nodes and on disabling
it we can select only a single node.
For more information on selectedNodes, refer to
selectedNodes.
Declaration
public TreeViewBuilder SelectedNodes(string[] selectedNodes)
Parameters
Type |
Name |
Description |
System.String[] |
selectedNodes |
|
Returns
ShowCheckBox(Boolean)
Indicates that the nodes will display CheckBoxes in the TreeView.
The CheckBox will be displayed next to the expand/collapse icon of the node. For more information on CheckBoxes, refer to
CheckBox.
Declaration
public TreeViewBuilder ShowCheckBox(bool showCheckBox = true)
Parameters
Type |
Name |
Description |
System.Boolean |
showCheckBox |
|
Returns
SortOrder(SortOrder)
Specifies a value that indicates whether the nodes are sorted in the ascending or descending order,
or are not sorted at all. The available types of sort order are,
None
- The nodes are not sorted.
Ascending
- The nodes are sorted in the ascending order.
Descending
- The nodes are sorted in the ascending order.
Declaration
public TreeViewBuilder SortOrder(SortOrder sortOrder)
Parameters
Returns