This example shows how to bind the WinForms Data Grid to LinqInstantFeedbackSource.
Set the LinqInstantFeedbackSource.KeyExpression property to a key property name.
linqInstantFeedbackSource.KeyExpression = "SupplierID";
Handle the LinqInstantFeedbackSource.GetQueryable event. Set the e.QueryableSource
property.
void OnGetQueryable(object sender, GetQueryableEventArgs e) {
NorthwindClassesDataContext dt = new NorthwindClassesDataContext();
e.QueryableSource = dt.Suppliers;
e.Tag = dt;
}
Handle the LinqInstantFeedbackSource.DismissQueryable event to dispose of a DataContext
object when it is no longer required.
void OnDismissQueryable(object sender, GetQueryableEventArgs e) {
(e.Tag as NorthwindClassesDataContext).Dispose();
}
Bind LinqInstantFeedbackSource
to the Grid control.
gridControl1.DataSource = linqInstantFeedbackSource;
(you will be redirected to DevExpress.com to submit your response)