Simultaneous Binding to Multiple Data Sources
The .Net Grid enables simple connection to different data sources simultaneously. The component model has IListSource interface that enables objects to return a list that can be bound to a data source. In the following example the grid uses this interface to bind multiple data sources.
public class MultipleDataSources : IListSource
{
private readonly IList _listSource = new ArrayList();
public IList GetList()
{
return _listSource;
}
public bool ContainsListCollection
{
get { return true; }
}
}
public void PopulateGrid(Grid grid)
{
BindingList<Order> orders = new BindingList<Order>();
BindingList<Strategy> strategies = new BindingList<Strategy>();
MultipleDataSources multipleSources = new MultipleDataSources();
multipleSources.GetList().Add(orders);
multipleSources.GetList().Add(strategies);
grid.DataSource = multipleSources;
}
Back to .Net Grid Features