您的位置:首页 > 其它

SortableObservableCollection<T>

2011-05-20 15:47 411 查看
View Code

/// <summary>
/// Create a instance of SortableObservableCollection.
/// </summary>
/// <typeparam name="T">Collection</typeparam>
public class SortableObservableCollection<T> : ObservableCollection<T>
{
public virtual void Sort()
{
this.Sort(0, Count, null);
}

public virtual void Sort(IComparer<T> comparer)
{
this.Sort(0, Count, comparer);
}

public virtual void Sort(int index, int count, IComparer<T> comparer)
{
(this.Items as List<T>).Sort(index, count, comparer);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: