GridControl: Binding row to a data source

In addition to GridControl.ItemsSource property that has become a common method of data binding in the grid, the grid provides a new API to bind individual rows to data sources Row.ItemsSource.

Row.ItemsSource = 'your data source';

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.

//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(GridControl grid, IList<Basket> baskets)
{
//Bind the grid to a basket collection
grid.ItemsSource = baskets;

//Bind an order collection to each basket row
foreach(Basket basket in baskets)
{
Row row = grid.DataObjects.FindFirstRow(basket);
if(row != null)
{
row.ItemsSource = basket.Orders;
}
}
}

Back to Wpf GridControl features