Пример #1
0
        internal void Sort(PropertyModel model)
        {
            PropertyViewModel prop = SortProperties.Find(p => p.Data == model);

            IEnumerable <SortDescription> result =
                Books.SortDescriptions.Cast <SortDescription>().Where(p => p.PropertyName == prop.Data.FullName);

            if (result != null && result.Count() == 1)
            {
                Books.SortDescriptions.Remove(result.First());
            }
            else
            {
                Books.SortDescriptions.Add(new SortDescription(prop.Data.FullName, ListSortDirection.Ascending));
            }

            RaisePropertyChanged("Books");
        }