Exemple #1
0
        internal virtual void ClearSort()
        {
            this.currentSortDescriptor = null;
            this.SortDirection         = SortDirection.None;

            this.UpdateHeaderControlSortDirection();
        }
        private void ChangeSortDescriptor(SortDescriptorBase newDescriptor)
        {
            if (this.Model != null && this.sortDescriptorCache != null)
            {
                this.Model.SortDescriptors.Remove(this.sortDescriptorCache);
            }

            this.sortDescriptorCache = newDescriptor;
        }
Exemple #3
0
        internal virtual void ToggleSort(bool allowMultiple)
        {
            if (!this.CanSort)
            {
                this.ClearSort();
                return;
            }

            this.updatingSort = true;

            if (!allowMultiple)
            {
                this.Model.SortDescriptors.Clear();
            }

            if (this.currentSortDescriptor == null)
            {
                this.currentSortDescriptor = this.GetSortDescriptor();
                if (this.currentSortDescriptor == null)
                {
                    // Do nothing, we have an inheritor that returns null as a SortDescriptor.
                    return;
                }

                this.currentSortDescriptor.SortOrder = SortOrder.Ascending;
                this.Model.SortDescriptors.Add(this.currentSortDescriptor);
                this.SortDirection = SortDirection.Ascending;
            }
            else if (this.SortDirection == SortDirection.Ascending)
            {
                this.currentSortDescriptor.SortOrder = SortOrder.Descending;
                if (!this.Model.SortDescriptors.Contains(this.currentSortDescriptor))
                {
                    this.Model.SortDescriptors.Add(this.currentSortDescriptor);
                }
                this.SortDirection = SortDirection.Descending;
            }
            else
            {
                this.Model.SortDescriptors.Remove(this.currentSortDescriptor);
                this.currentSortDescriptor = null;
                this.SortDirection         = SortDirection.None;
            }

            this.updatingSort = false;

            this.UpdateHeaderControlSortDirection();
        }
Exemple #4
0
        internal virtual void OnDescriptorAssociated(DataDescriptor descriptor)
        {
            if (descriptor is FilterDescriptorBase)
            {
                this.isFiltered = true;

                this.UpdateFilterVisualState(this.isFiltered);
            }
            else if (descriptor != this.currentSortDescriptor)
            {
                var sortDescriptor = descriptor as SortDescriptorBase;
                if (sortDescriptor != null)
                {
                    this.currentSortDescriptor = sortDescriptor;
                    this.SortDirection         = this.currentSortDescriptor.SortOrder == SortOrder.Ascending ? SortDirection.Ascending : SortDirection.Descending;
                }
            }
        }