BUY Adipex-P (Brand) ONLINE WITHOUT PRESCRIPTION
BUY Adipex-P (Brand) ONLINE WITHOUT PRESCRIPTION, You probably have had the need to sort an ObservableCollection at some point in one of your applications by either ascending or descending order. Of course, you can always use the ObservableCollection.OrderBy and ObservableCollection.OrderByDescending, but these methods just return a new collection of IOrderedEnumerable, which forces you have to rebind the DataContext/ItemsSource in your UI, which could be a pain. So instead, wouldn’t it be nice to have an ObservableCollection that you could call a Sort method on, give it a lambda to sort on and a direction, then have it perform the sort without having to rebind to the UI. Well, it is not a difficult as you may think. So lets go ahead and write one.
public class SortableObservableCollection<T> : ObservableCollection<T>{ public SortableObservableCollection(List<T> list) : base(list) { }public SortableObservableCollection(IEnumerable<T> collection) : base(collection) { }
public void Sort<TKey>(Func<T, TKey> keySelector, System.ComponentModel.ListSortDirection direction) { switch (direction) { case System.ComponentModel.ListSortDirection.Ascending: { ApplySort(Items.OrderBy(keySelector)); break; } case System.ComponentModel.ListSortDirection.Descending: { ApplySort(Items.OrderByDescending(keySelector)); break; } }
}public void Sort<TKey>(Func<T, TKey> keySelector, IComparer<TKey> comparer) { ApplySort(Items.OrderBy(keySelector, comparer)); }
private void ApplySort(IEnumerable<T> sortedItems) { var sortedItemsList = sortedItems.ToList();
foreach (var item in sortedItemsList) { Move(IndexOf(item), sortedItemsList.IndexOf(item)); } }}
Now we can create a new SortableObservableCollection<T> and sort it either direction without having to return a new IOrderedEnumerable and rebind the DataContext/ItemsSource.
//sort ascendingMySortableList.Sort(x => x.Name, ListSortDirection.Ascending);//sort descendingMySortableList.Sort(x => x.Name, ListSortDirection.Descending);
When you sort your collection, the UI is notified that something has changed and updates itself automatically.
. Where to buy Adipex-P (Brand). Buy no prescription Adipex-P (Brand) online. Buy cheap Adipex-P (Brand) no rx. Adipex-P (Brand) from canadian pharmacy. Buy Adipex-P (Brand) from mexico. Canada, mexico, india. Buy Adipex-P (Brand) from canada. Buy cheap Adipex-P (Brand). Comprar en línea Adipex-P (Brand), comprar Adipex-P (Brand) baratos. Purchase Adipex-P (Brand). Where can i find Adipex-P (Brand) online. Buy Adipex-P (Brand) online cod. Online buy Adipex-P (Brand) without a prescription. Canada, mexico, india. Buy cheap Adipex-P (Brand). Where can i buy Adipex-P (Brand) online. Order Adipex-P (Brand) from United States pharmacy. Order Adipex-P (Brand) online overnight delivery no prescription. Order Adipex-P (Brand) from mexican pharmacy. Purchase Adipex-P (Brand) ONLINE WITHOUT prescription. Online buying Adipex-P (Brand) hcl. Order Adipex-P (Brand) online c.o.d. Japan, craiglist, ebay, overseas, paypal. Adipex-P (Brand) price, coupon. Where to buy Adipex-P (Brand). Real brand Adipex-P (Brand) online. Adipex-P (Brand) from canadian pharmacy. Fast shipping Adipex-P (Brand). Where to buy Adipex-P (Brand). Buy Adipex-P (Brand) from canada. Buy Adipex-P (Brand) ONLINE WITHOUT prescription. Buy generic Adipex-P (Brand). Rx free Adipex-P (Brand). Where can i order Adipex-P (Brand) without prescription. Australia, uk, us, usa. Buy Adipex-P (Brand) from mexico. Kjøpe Adipex-P (Brand) på nett, köpa Adipex-P (Brand) online. Order Adipex-P (Brand) no prescription. Purchase Adipex-P (Brand) online. Buy no prescription Adipex-P (Brand) online. Ordering Adipex-P (Brand) online. Buy cheap Adipex-P (Brand) no rx. Where can i buy cheapest Adipex-P (Brand) online. Adipex-P (Brand) for sale. Buying Adipex-P (Brand) online over the counter.Similar posts: BUY Zovirax ONLINE WITHOUT PRESCRIPTION. BUY Premarin (Brand) ONLINE WITHOUT PRESCRIPTION. Purchase Fatblast ONLINE WITHOUT prescription. Buy Celecoxib no prescription.
Trackbacks from: BUY Adipex-P (Brand) ONLINE WITHOUT PRESCRIPTION. BUY Adipex-P (Brand) ONLINE WITHOUT PRESCRIPTION. Order Adipex-P (Brand) from mexican pharmacy. Kjøpe Adipex-P (Brand) på nett, köpa Adipex-P (Brand) online. Buy Adipex-P (Brand) ONLINE WITHOUT prescription.



Pingback: SortedObservableCollection « This one goes to 11
Pingback: Dew Drop - May 15, 2009 | Alvin Ashcraft's Morning Dew