This is a migrated thread and some comments may be shown as answers.

[Solved] How to ensure nested grid view items remain sorted when new items are added?

0 Answers 72 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sergey
Top achievements
Rank 1
Sergey asked on 11 Jan 2013, 01:43 PM
I am trying to achieve automatic sorting of items in child grid view when new items gets added to ItemsSource collection by using  QueryableCollectionView items source. I modified "RadGridView_WPF_AR_3" project posted here and added two new properties in the view model:

QueryableCollectionView _clubsView;
public QueryableCollectionView ClubsView
{
    get
    {
        if (_clubsView == null)
        {
            _clubsView = new QueryableCollectionView(Clubs);
            _clubsView.SortDescriptors.Add(new SortDescriptor
            {
                Member = "Name",
                SortDirection = ListSortDirection.Descending
            });
        }
 
        return _clubsView;
    }
}
 
QueryableCollectionView _playersView;
public QueryableCollectionView PlayersView
{
    get
    {
        if (_playersView == null)
        {
            _playersView = new QueryableCollectionView(Players);
            _playersView.SortDescriptors.Add(new SortDescriptor
            {
                Member = "Name",
                SortDirection = ListSortDirection.Descending
            });
        }
 
        return _playersView;
    }
}

I've set clubs grid view ItemsSource to ClubsView and players grid view ItemsSource to PlayersView.

QueryableCollectionView doesn't appear to work for child grids, because when I expand child grid views each time I see empty list. Is it possible to achieve auto sorting in child grids using QueryableCollectionView or in some other way? 
Tags
GridView
Asked by
Sergey
Top achievements
Rank 1
Share this question
or