DataGrid Binding to a BindingListCollectionView RRS feed

  • Question

  • Hello,

    I posted the following question about DataGrid Binding and BindingListCollectionView a couple of weeks ago, and now I'm experiencing another problem from the same issue. Just to remember:

    "I'm following the great video series about using WPF and EntityFramework. Today I watched this video: http://msdn.microsoft.com/en-us/vbasic/ee364701.aspx#

    In my real scenario, I must bind the details to a datagrid (from WPFToolkit). The issue is that it seems that binding the datagrid to a BindingListCollectionView disallow the grid to automatically sort columns (when you click on the column header).

    If I bind to a ListCollectionView, it does work, but this does not fit the examples shown in the video."

    So, as my datagrid contains details (form master/details approach) I must use BindingListCollectionView, but when the user inserts a new row in the grid the InsertItem overridden method (overridden from ObservableCollection) is not fired, as it should happen. I suppose the BindingListCollectionView does not implements some necessary interface that would do what I expect.

    So what can I do to solve this. I was thinking about capturing some datgrid event and manually insert a new item in the view/collection. What do you suggest?

    Just to clarify, the datagrid binding is being made like this:

    <CollectionViewSource x:Key="MaterialsSource"></CollectionViewSource>
    <CollectionViewSource x:Key="RepositorySource" Source="{Binding Source={StaticResource MaterialsSource}, Path=PieceGroups}"/>
    The RepositorySource is bound to the datagrid.

    Thanks in advance,


    Project Manager at INOVATIVA Tecnologia www.inovativatec.com
    • Moved by Figo Fei Wednesday, September 30, 2009 4:09 AM WPF Q (From:Visual C# General)
    Tuesday, September 29, 2009 2:06 PM