Exemplo n.º 1
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);
 }
        private GridGroupByExpression CreateGridGroupByExpression(
            GroupDescriptor groupDescription)
        {
            GridGroupByExpression groupByExpression = new GridGroupByExpression();

            for (int index = 0; index < groupDescription.GroupNames.Count; ++index)
            {
                groupByExpression.GroupByFields.Add(new GridGroupByField(groupDescription.GroupNames[index].PropertyName)
                {
                    SortOrder = GridViewHelper.GetSortDirection(groupDescription.GroupNames[index].Direction)
                });
            }
            return(groupByExpression);
        }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
 private void GroupByFields_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     this.GroupNames.BeginUpdate();
     this.GroupNames.Clear();
     for (int index = 0; index < this.groupByFields.Count; ++index)
     {
         this.GroupNames.Add(this.groupByFields[index].FieldName, GridViewHelper.GetSortDirection(this.groupByFields[index].SortOrder));
     }
     this.GroupNames.EndUpdate();
     if (this.IsDuplicateEvent(e, this.selectFields))
     {
         return;
     }
     this.OnPropertyChanged("GroupByFields");
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }