This advice is taken from porting a DevEx Hierarchical Grid from DevForce Classic to DevForce EF.
Assume that Customer is parent object and Order is the child object.
Try using a BindableList as the DataSource. The BindableList has special code that allows it to operate with advanced features of various grids. So just move the results of your EF queries into a BindableLists.
Try creating a new property on you customer object called “Orders2”. This property should be a BindableList<Order>. Then bind to Orders2 instead of Orders in your AddRelationView line.
Here is the custom property on Customer:
public BindableList<Order> Orders2 {
get {
BindableList<Order> mOrders = new BindableList<Order>();
mOrders.AddRange(this.Orders);
return mOrders;
}
}
Here is the final code for the nested grid:
_ordersXGBM.GridView = _customersXGBM.AddRelationView("Order", "Orders2");
this.gridView2.LayoutChanged();
_ordersXGBM.GridView.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;