Home Forums WPF controls Xceed DataGrid for WPF Datagrid and ORM tools

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #24028 |

    Can anyone shed some insight on using the wpf data grid with ORM tools?
    I have had very bad luck so far. My commercial product did not support the needed interfaces (for xceed grid or WPF in general) so I switched to NHibernate. It seems to have good binding support for objects, but I am having difficulty understanding how to make collections work with the grid.
    When I bind a grid to a collection I am unable to add rows, and update to objects sometimes show in the grid, sometimes they do not.

    A simple NHibernate Xceed Grid sample with insert, update and deletes would be very helpful.


    Imported from legacy forums. Posted by Mike (had 497 views)

    User (Old forums)
    Post count: 23064

    Checkout DevExpress eXpress Persistent Objects (XPO).

    I’m having good success with using this ORM with Xceed DataGrid.

    I use a DataGridCollectionView to wrap my XPO collection as shown below.

    The Xceed doc on the DataGridCollectionView may be found at

    Also, check out the info on MSDN for WPF binding for more context.

    // See the following post for an explanation of why the XpoCollection is cast to an IBindingList
    // ** http://forums.xceed.com/forums/ShowPost.aspx?PostID=7808
    // NOTE: If a collection implements INotifyCollectionChanged, the adding doesn’t work properly. That’s why
    // with XPO we have to extract the IBindingList from the BindingListCollectionView,
    // because BindingListCollectionView implments INotifyCollectionChanged.

    BindingListCollectionView bindingListView = CollectionViewSource.GetDefaultView(TheXpoCollection) as BindingListCollectionView;

    IBindingList ibl = (IBindingList)TheXpoCollection;

    DataGridCollectionView dgcv = null;
    if (ibl != null)
    dgcv = new DataGridCollectionView(ibl);
    dgcv = new DataGridCollectionView(bindingListView);

    Brian Noyes provides good insight on some of the interfaces involved in data binding as they relate to Windows Forms, but it’s doesn’t deal with WPF at all:

    Data Binding with Windows Forms 2.0: Programming Smart Client Data Applications with .NET (Microsoft .NET Development Series) (Paperback)

    Imported from legacy forums. Posted by Richard (had 2772 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.