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

Gridview with SortDescription doesnot update UI after ItemsSource rebound

0 Answers 305 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vinay
Top achievements
Rank 1
Vinay asked on 19 Jan 2018, 11:14 AM

Hi,

I am binding my observablecollection to CollectionViewSource which has SortDescriptions. On initial load everything loads fine and sorting can be done. 

I have a reset button on which i am trying to refresh the changes in the grid with re fetching observablecollection and binding to ItemSource. Once i do the rebind the sorting doesnot work. 

Below is my collectionviewsource,

<CollectionViewSource
                x:Key="BuildLineSource"
                IsLiveSortingRequested="True"
                Source="{Binding BuildLineCollection,
                                 UpdateSourceTrigger=PropertyChanged}">
                <CollectionViewSource.GroupDescriptions>
                    <PropertyGroupDescription PropertyName="BuildLineCategory.Category" />
                </CollectionViewSource.GroupDescriptions>
                <CollectionViewSource.LiveSortingProperties>
                    <system:String>ExecutePriority</system:String>
                </CollectionViewSource.LiveSortingProperties>
                <CollectionViewSource.SortDescriptions>
                    <componentModel:SortDescription PropertyName="ExecutePriority" />
                </CollectionViewSource.SortDescriptions>
            </CollectionViewSource>

 

Below is the code i am calling on Constructor and also on Reset click,

private void GetBuildLines()
        {
            BuildLineCollection?.Clear();
            BuildLineCollection = _buildLineData.GetBuildLines();           
            ((INotifyPropertyChanged)BuildLineCollection).PropertyChanged +=
                (x, y) => BuildLineUpdated();
        }

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Vinay
Top achievements
Rank 1
Share this question
or