예제 #1
0
        private void btnSort_Click(object sender, RoutedEventArgs e)
        {
            SortItem item = (sender as Button).Tag as SortItem;

            if (item != null)
            {
                SortTasks(item);
            }
        }
예제 #2
0
        public void SortTasks(SortItem item, bool?desc = null)
        {
            ICollectionView view = CollectionViewSource.GetDefaultView(ViewModel.Tasks);

            if (view != null)
            {
                SortDescription sortDesc = CollectionHelper.SortCollection(view, item.Property, item.StartDescending);
                ViewModel.Sorts.SortBy(sortDesc.PropertyName, desc != null ? desc.Value : sortDesc.Direction == ListSortDirection.Descending);
            }
        }