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

GridView does not respect the empty GroupDescriptions of new ItemsSource

1 Answer 37 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Art
Top achievements
Rank 1
Art asked on 04 Oct 2017, 11:01 AM

I've found strange behavior:

MVVM class has property of type PagedCollectionView, named as "Items". RadGridView has binding to it as ItemsSource.

When I trying to set a new value to Items as

ApplyGrouping(items);
Items = items; // GroupDescriptions already set before, so calling the INotifyPropertyChanged.PropertyChanged event.

 

it works correct only when GroupDescriptions of new collection has any GroupDescription defined.

Otherwise, if new collection has no GroupDescriptions, GridView keeps descriptions from previous collection.

Telerik version 2017.2.503.1050

1 Answer, 1 is accepted

Sort by
0
Art
Top achievements
Rank 1
answered on 04 Oct 2017, 11:06 AM

I've done it with clearing descriptions on old value of Items before setting the new one. But it's not good anyway.

        public PagedCollectionView Items
        {
            get { return _items; }
            private set
            {
//                var oldItems = _items;
//
//                if (oldItems != null)
//                    oldItems.GroupDescriptions.Clear();
 
                Set(() => Items, ref _items, value);
            }
        }
Tags
GridView
Asked by
Art
Top achievements
Rank 1
Answers by
Art
Top achievements
Rank 1
Share this question
or