TreeView for WinForms | ComponentOne
In This Topic
    Data Binding
    In This Topic

    The process of connecting a data consumer with a data source is known as data binding. TreeView for WinForms supports data binding in two modes: unbound mode and bound mode.

    The unbound mode means that the TreeView control is not bound to any data source. In the unbound mode, you need to create columns and nodes manually either by using designer or programmatically. To create nodes in the unbound mode at design-time, you can simply add the nodes in TreeNodes Editor. For more details on how to access TreeNodes Editor, refer to Collection Editors. If you want to create nodes in the unbound mode programmatically, you can do so by using the Add and the Insert methods. For more information, refer to add nodes and remove nodes.

    In the bound mode, the TreeView control uses data from a data source and displays it in the form of parent and child nodes in a hierarchical manner. TreeView supports a number of data source objects, namely, BindingSource, List, DataView, DataTable, DataSet, and objects implementing particular interfaces like IBindingList and IList.

    To bind TreeView to a data source object, you need to use the DataSource property of C1TreeView. You can specify the type of the bound mode for TreeView by setting the TreeBoundMode property to one of the following values from the TreeBoundMode enumeration:

    Once you have set the data source, you can set the list of fields to display in columns by using the DisplayFieldName property of C1TreeColumn. For more information, see TreeView Columns.

    Refer to the following topics to know how you can bind TreeView to different objects: