HeaderPane
Main
Hide
Share Link
Print

DataSource Property, SftTree Class

Defines the data source whose rows become the items of the control.

Class: SftTree
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public object DataSource { get; set; }
Public Property DataSource As Object

Value

A list (IList, such as an array or a List), a list source (IListSource, such as a DataTable or DataSet), a BindingSource, or null/Nothing to show the items added by the application.

The default value is null/Nothing.

Comments

Defines the data source whose rows become the items of the control.

Each row of the data source becomes an item. The ColumnClass.DataMember property of each column names the property (or data column) shown in the column's cells. The hierarchy is defined either by DataKeyMember and DataParentMember (rows refer to their parent row by key) or by DataChildrenMember (each row has a list of child rows); without them, all items are top-level items.

The control follows changes of the data source when it reports them (IBindingList, such as a BindingList, a DataView or a BindingSource): items are added, removed and updated, and expanded and selected items stay expanded and selected. The selected item and the current row of the data source (the Position of its CurrencyManager) follow each other.

While a data source is set, items cannot be added, removed or sorted by the application (the data source can be sorted instead), but their cells can be changed, typically in the ItemDataBound event. Changes made to cells are not written back to the data source.

See Also SftTree Class | Classes | SftTree/NET 3.0