Gets or sets the data source for the specified Row.
Namespace: Dapfor.Net.UiAssembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
C# |
---|
public Object DataSource { get; set; } |
Visual Basic |
---|
Public Property DataSource As Object Get Set |
Visual C++ |
---|
public: property Object^ DataSource { Object^ get (); void set (Object^ value); } |
F# |
---|
member DataSource : Object with get, set |
Property Value
Type: ObjectThe data source.
Remarks
In addition to Grid.DataSource property that has become a common method of data binding in the grid, starting from version 2.5.0 the grid provides a new API to bind either the grid or individual rows to data sources.
The bound data source may implement IList or IBindingList interfaces. If the bound data source implements IBindingList interface, the grid subscribes to notifications of this data collection and enables automated thread-safe management of content changes.
Examples
Copy | |
---|---|
//Basket class public class Basket { //Private fields private readonly BindingList<Order> _orders = new BindingList<Order>(); //Public properties public IList<Order> Orders { get { return _orders; } } } //Initialize the grid public void InitializeGrid(Grid grid, IList<Order> baskets) { //Bind the grid to a basket collection grid.DataSource = baskets; //Bind an order collection to each basket row foreach (Basket basket in baskets) { Row row = grid.DataObjects.FindFirstRow(basket); if (row != null) { row.DataSource = basket.Orders; } } } |