Beispiel #1
0
 protected override void OnPropertyChanging(RadPropertyChangingEventArgs e)
 {
     if (this.ownerTemplate == null)
     {
         return;
     }
     if (e.Property == GridViewColumn.WidthProperty)
     {
         int newValue = (int)e.NewValue;
         int maxWidth = this.MaxWidth;
         int minWidth = this.MinWidth;
         e.Cancel = newValue <minWidth || maxWidth> minWidth && newValue > maxWidth && maxWidth > 0;
         this.OwnerTemplate.BestFitQueue.Dequeue(this);
         if (this.EventDispatcher != null)
         {
             ColumnWidthChangingEventArgs args = new ColumnWidthChangingEventArgs(this.Index, newValue);
             args.Cancel = e.Cancel;
             this.EventDispatcher.RaiseEvent <ColumnWidthChangingEventArgs>(EventDispatcher.ColumnWidthChanging, (object)this, args);
             e.Cancel = args.Cancel;
         }
     }
     else if (e.Property == GridViewColumn.IsCurrentProperty)
     {
         if (this.ownerTemplate.MasterTemplate == null || GridViewSynchronizationService.IsEventSuspended(this.ownerTemplate, KnownEvents.CurrentChanged))
         {
             return;
         }
         if ((bool)e.NewValue)
         {
             if (!this.CanBeCurrent)
             {
                 e.Cancel = true;
                 return;
             }
             this.ownerTemplate.MasterTemplate.CurrentColumn = this;
             e.Cancel = this.ownerTemplate.MasterTemplate.CurrentColumn != this;
         }
         else
         {
             this.ownerTemplate.MasterTemplate.CurrentColumn = (GridViewColumn)null;
             e.Cancel = this.ownerTemplate.MasterTemplate.CurrentRow != null;
         }
     }
     else if (e.Property == GridViewColumn.IsVisibleProperty)
     {
         bool newValue = (bool)e.NewValue;
         e.Cancel = !newValue && !this.AllowHide && this.GetVisibleColumnsCount((IEnumerable)this.OwnerTemplate.Columns) > 1;
     }
     else if (e.Property == GridViewColumn.NameProperty)
     {
         string newValue = (string)e.NewValue;
         if (this.ownerTemplate.Columns.Contains(newValue) && this != this.ownerTemplate.Columns[newValue])
         {
             throw new InvalidOperationException("A column with the same Name already exists in the collection");
         }
         this.ownerTemplate.Columns.Rename((string)e.OldValue, newValue);
     }
     base.OnPropertyChanging(e);
 }
Beispiel #2
0
        private bool OnIsCurrentPropertyChanging(PropertyChangingEventArgsEx args)
        {
            if (GridViewSynchronizationService.IsEventSuspended(this.ViewTemplate, KnownEvents.CurrentChanged))
            {
                return(false);
            }
            bool newValue = (bool)args.NewValue;

            if (newValue && !this.CanBeCurrent)
            {
                return(true);
            }
            GridViewRowInfo row    = newValue ? this : (GridViewRowInfo)null;
            GridViewColumn  column = this.ViewTemplate.CurrentColumn ?? MasterGridViewTemplate.GetColumnAllowingForCurrent(this.ViewTemplate);

            GridViewSynchronizationService.RaiseCurrentChanged(this.ViewTemplate, row, column, true);
            return(this.ViewTemplate.MasterTemplate.CurrentRow != row);
        }