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();
}