System.Windows.Data.DataList.UpdateSort C# (CSharp) Method

UpdateSort() public method

Sets the comparer to use to sort the items contained in this DataList.
public UpdateSort ( IComparer comparer ) : void
comparer IComparer The comparer to use; null if no sort is to be applied.
return void
        public void UpdateSort(IComparer<object> comparer)
        {
            if ((_comparer == null) && (comparer == null)) {
                return;
            }

            object currentItem = null;
            if (IsCurrencyEnabled && (_snapShot != null)) {
                currentItem = CurrentItem;
            }

            _comparer = comparer;
            _snapShot = null;

            if (currentItem != null) {
                EnsureSnapShot();

                int index = _snapShot.IndexOf(currentItem);
                CurrentIndex = index;

                RaisePropertyChanged("CanMovePrevious");
                RaisePropertyChanged("CanMoveNext");
            }

            UpdateVersion();
            RaiseCollectionReset();
        }