1 // -------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All Rights Reserved.
3 // -------------------------------------------------------------------
4 //From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data
5 namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data
8 using System.Collections;
9 using System.Collections.Generic;
10 using System.Collections.ObjectModel;
11 using System.Collections.Specialized;
12 using System.ComponentModel;
16 // Workaround for ObservableCollection not supporting IComparers. The implementation was copied from ObservableCollection.
18 // <typeparam name="T"></typeparam>
19 internal sealed class ObservableCollectionWorkaround<T> : ObservableCollection<T>
21 public ObservableCollectionWorkaround()
25 public ObservableCollectionWorkaround(List<T> list)
30 public ObservableCollectionWorkaround(ICollection collection)
32 foreach (T item in collection)
38 public int BinarySearch(T value, IComparer<T> comparer)
40 return ((List<T>)base.Items).BinarySearch(value, comparer);
45 ((List<T>)base.Items).Sort();
46 this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
47 this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1));
50 public void Sort(IComparer<T> comparer)
52 ((List<T>)base.Items).Sort(comparer);
53 this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
54 this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1));
57 public void Sort(Comparison<T> comparison)
59 ((List<T>)base.Items).Sort(comparison);
60 this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
61 this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1));
66 ((List<T>)base.Items).Reverse();