Does PageCollectionView work differently in WPF with the ListCollectionView?

0

When I pass the ObservableCollection and I order it with Linq it does not work but if I pass it directly it works. In SilverLigth it worked passing the ordered list. Why is this?

Silverlight code

ListaAOrdenar = new ObservableCollection<Units>();
Filtro = new PagedCollectionView(ListaAOrdenar.OrderBy(b => b.Unidad).ThenBy(c => c.fecha));
dataGrid.ItemsSource = Filtro;

WPF code

ListaAOrdenar = new ObservableCollection<Units>();
Filtro = new ListCollectionView(ListaAOrdenar.OrderBy(b => b.Unidad).ThenBy(c => c.fecha));
dataGrid.ItemsSource = Filtro;
    
asked by astercraker 28.07.2017 в 21:53
source

1 answer

0

ItemSource waits for an Ienumerable object,

     ListaAOrdenar.OrderBy(b => b.Unidad).ThenBy(c => c.fecha);

returns IOrderedEnumerable

You'll have to pass it to Ienumerable

      ListaAOrdenar.OrderBy(b => b.Unidad).ThenBy(c => c.fecha).ToList()
    
answered by 10.01.2018 в 22:35