Quantcast
Channel: Active questions tagged listview - Stack Overflow
Viewing all articles
Browse latest Browse all 611

Sorting a List by its property renames all the objects in the List [closed]

$
0
0

I have a class called Task in which I have properties like Date, Id, priority and Name. I have a list where I store objects of this class. The problem is that when I do the sorting and then display it in my Listview (I am working in WPF framework coz it is a part of the assigment) all the tasks get renamed tothe same thing (TODO-list.task.Task) from their original name and I have no idea if the sorting actually worked.

I use this to sort the list:

List<Task> sort_by_date = tasks.OrderBy(x => x.Date).ToList();

And then write it out to list view like this:

MainWindow.withDate.Item.Clear();MainWindow.withDate.ItemsSource = sort_by_date;

EDIT: Already figured it out...it was a small thing in writing out teh listview


Viewing all articles
Browse latest Browse all 611

Trending Articles



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