Linq seems to be the suggested way now that Sort and Filter have gone AWOL.
So you could adopt something like this in your model:
private MyDataSourceProvider dataSource;
private ObservableCollection<MyType> sortedDataBackingField;
public ObservableCollection<MyType> SortedData
{
get
{
return sortedDataBackingField;
}
set
{
sortedDataBackingField = value;
NotifyPropertyChanged("SortedData");
}
}
public void SortByName()
{
SortedData = new ObservableCollection<MyType>(dataSource.Entities.OrderBy(
entity => entity.Name));
}
public void SortByAge()
{
SortedData = new ObservableCollection<MyType>(dataSource.Entities.OrderBy(
entity => entity.Age));
}
Hook SortByName and SortByAge up to your UI in the pattern of your choice, and simply bind to the SortedData property:
<ItemsControl ItemsSource=”{Binding SortedData}”/>
Edit: With reference to transitions, you should find that this approach will trigger the AddDeleteThemeTransition for the items that you've sorted; just add something like this inside the ItemsControl:
<ItemsControl.ItemContainerTransitions>
<TransitionCollection>
<AddDeleteThemeTransition></AddDeleteThemeTransition>
</TransitionCollection>
</ItemsControl.ItemContainerTransitions>