Example #1
0
        protected override void InitializeFields()
        {
            base.InitializeFields();
            this.Text = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ColumnChooserFormMessage");

            this.StretchHorizontally = true;
            this.sortOrder           = RadSortOrder.None;
            this.Class = nameof(ColumnChooserElement);
        }
Example #2
0
 protected override void OnPropertyChanged(PropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (!(e.PropertyName == "Direction") || this.Owner == null || !this.Owner.Contains((SortDescriptor)this))
     {
         return;
     }
     this.sortOrder = GridViewHelper.GetSortDirection(this.Direction);
 }
Example #3
0
 public GridSortField(string fieldName, RadSortOrder sortOrder)
     : base(string.Empty, ListSortDirection.Ascending)
 {
     if (!string.IsNullOrEmpty(fieldName))
     {
         List <SortDescriptor> sortString = DataUtils.ParseSortString(fieldName);
         if (sortString.Count > 0)
         {
             this.PropertyName = sortString[0].PropertyName;
         }
     }
     this.Direction = GridViewHelper.GetSortDirection(sortOrder);
     this.sortOrder = sortOrder;
 }
Example #4
0
        public static string SortOrderAsString(RadSortOrder sortOrder)
        {
            switch (sortOrder)
            {
            case RadSortOrder.Ascending:
                return("ASC");

            case RadSortOrder.Descending:
                return("DESC");

            default:
                return("");
            }
        }
Example #5
0
        internal static ListSortDirection GetSortDirection(RadSortOrder radSortOrder)
        {
            switch (radSortOrder)
            {
            case RadSortOrder.Ascending:
                return(ListSortDirection.Ascending);

            case RadSortOrder.Descending:
                return(ListSortDirection.Descending);

            default:
                return(ListSortDirection.Ascending);
            }
        }
Example #6
0
        public GridSortField(string fieldName)
            : base(string.Empty, ListSortDirection.Ascending)
        {
            if (string.IsNullOrEmpty(fieldName))
            {
                return;
            }
            List <SortDescriptor> sortString = DataUtils.ParseSortString(fieldName);

            if (sortString.Count <= 0)
            {
                return;
            }
            this.PropertyName = sortString[0].PropertyName;
            this.Direction    = sortString[0].Direction;
            this.sortOrder    = GridViewHelper.GetSortDirection(this.Direction);
        }
Example #7
0
 public GridGroupByField(string fieldName, Type dataType)
 {
     this.fieldName = fieldName;
     this.dataType  = dataType;
     this.sortOrder = RadSortOrder.Ascending;
 }
Example #8
0
 public GridGroupByField(string fieldName)
 {
     this.fieldName = fieldName;
     this.sortOrder = RadSortOrder.Ascending;
 }
Example #9
0
 public GridGroupByField()
 {
     this.sortOrder = RadSortOrder.Ascending;
 }
Example #10
0
        public void UpdateArrowState()
        {
            if (!this.IsInValidState(true))
            {
                return;
            }
            RadSortOrder columnSortOrder = this.GetColumnSortOrder();

            if (columnSortOrder == RadSortOrder.None)
            {
                this.sortOrder = new RadSortOrder?(RadSortOrder.None);
                int num1 = (int)this.SetValue(VirtualGridHeaderCellElement.IsSortedAscendingProperty, (object)false);
                int num2 = (int)this.SetValue(VirtualGridHeaderCellElement.IsSortedDescendingProperty, (object)false);
                if (this.Arrow.Visibility == ElementVisibility.Hidden)
                {
                    return;
                }
                this.Arrow.Visibility = ElementVisibility.Hidden;
            }
            else
            {
                RadSortOrder radSortOrder1 = columnSortOrder;
                RadSortOrder?sortOrder1    = this.sortOrder;
                RadSortOrder radSortOrder2 = radSortOrder1;
                if ((sortOrder1.GetValueOrDefault() != radSortOrder2 ? 1 : (!sortOrder1.HasValue ? 1 : 0)) != 0)
                {
                    this.sortOrder = new RadSortOrder?(radSortOrder1);
                    RadSortOrder?    sortOrder2     = this.sortOrder;
                    ref RadSortOrder?local          = ref sortOrder2;
                    RadSortOrder     valueOrDefault = local.GetValueOrDefault();
                    if (local.HasValue)
                    {
                        switch (valueOrDefault)
                        {
                        case RadSortOrder.Ascending:
                            this.Arrow.Direction = ArrowDirection.Up;
                            if (this.Arrow.Visibility != ElementVisibility.Visible)
                            {
                                this.Arrow.Visibility = ElementVisibility.Visible;
                                break;
                            }
                            break;

                        case RadSortOrder.Descending:
                            this.Arrow.Direction = ArrowDirection.Down;
                            if (this.Arrow.Visibility != ElementVisibility.Visible)
                            {
                                this.Arrow.Visibility = ElementVisibility.Visible;
                                break;
                            }
                            break;

                        case RadSortOrder.None:
                            if (this.Arrow.Visibility != ElementVisibility.Hidden)
                            {
                                this.Arrow.Visibility = ElementVisibility.Hidden;
                                break;
                            }
                            break;
                        }
                    }
                }
                int num1 = (int)this.SetValue(VirtualGridHeaderCellElement.IsSortedAscendingProperty, (object)(columnSortOrder == RadSortOrder.Ascending));
                int num2 = (int)this.SetValue(VirtualGridHeaderCellElement.IsSortedDescendingProperty, (object)(columnSortOrder == RadSortOrder.Descending));
            }
Example #11
0
 public void Add(string fieldName, RadSortOrder sortOrder)
 {
     this.Add((SortDescriptor) new GridSortField(fieldName, sortOrder));
 }
Example #12
0
        public bool Sort(RadSortOrder sortOrder, bool multiSortMode)
        {
            if (!this.CanSort || this.ownerTemplate == null)
            {
                return(false);
            }
            SortDescriptor           descriptor      = new SortDescriptor(this.Name, GridViewHelper.GetSortDirection(sortOrder));
            SortDescriptorCollection sortDescriptors = this.ownerTemplate.SortDescriptors;
            bool flag = !multiSortMode && sortDescriptors.Count > 1;

            if (flag)
            {
                if (sortOrder == RadSortOrder.None)
                {
                    descriptor = (SortDescriptor)null;
                }
                if (this.RaiseSortingChanging(descriptor))
                {
                    return(false);
                }
                sortDescriptors.BeginUpdate();
                sortDescriptors.Clear();
            }
            int index = sortDescriptors.IndexOf(this.Name);

            if (index >= 0)
            {
                if (sortOrder == RadSortOrder.None)
                {
                    sortDescriptors.RemoveAt(index);
                    return(true);
                }
                if (sortOrder == GridViewHelper.GetSortDirection(sortDescriptors[index].Direction))
                {
                    return(false);
                }
                sortDescriptors[index].Direction = GridViewHelper.GetSortDirection(sortOrder);
                return(true);
            }
            if (sortOrder == RadSortOrder.None)
            {
                if (flag)
                {
                    sortDescriptors.EndUpdate();
                }
                return(false);
            }
            if (!multiSortMode && sortDescriptors.Count == 1)
            {
                sortDescriptors[0] = descriptor;
            }
            else
            {
                sortDescriptors.Add(descriptor);
            }
            if (flag)
            {
                sortDescriptors.EndUpdate();
            }
            return(true);
        }