i try to sort a wpf Listview, this works fine .. but only if i add new Items as simple Objects:
this works:
listview_files.Items.Add(new { isdir = (String)ele.Element("isdir"), number = (int)ele.Element("id"), name = (String)ele.Element("name"), size = groesse, right = modes, date = (String)ele.Element("date") });
with:
listview_files.Items.SortDescriptions.Add(new SortDescription(sortBy, direction));
but if i add the items like this:
ListViewItem myitem = new ListViewItem();
myitem.Content=new { isdir = (String)ele.Element("isdir"), number = (int)ele.Element("id"), name = (String)ele.Element("name"), size = groesse, right = modes, date = (String)ele.Element("date") };
myitem.ContextMenu = con2;
myitem.MouseDoubleClick += myitem_MouseDoubleClick;
listview_files.Items.Add(myitem);
it will allways sort to the same, there is no difference between sortdirection or clicked colum (Values of sortBy, direction are allways correct) I think the Problem is the "Content" Property, but how can i force the SortDescription to use the ListViewItem.Content Proberty for sorting?