Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF GridView Sort

$
0
0

I have a GridView which binds the customer list. When I click on the headers then it gives me the following error.

I have a method and  I get the error from there. The code is below.

private void Sort(string sortBy, ListSortDirection direction)
        {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(this.ItemsSource);
                dataView.SortDescriptions.Clear();
                SortDescription sd = new SortDescription(sortBy, direction);
                dataView.SortDescriptions.Add(sd);
                dataView.Refresh();
        }


KAdir


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>