Esempio n. 1
0
 private void GridControl_FilterChanged(object sender, GridViewCollectionChangedEventArgs e)
 {
     if (!this.shouldCheckDataRows || this.ViewInfo == null || this.ColumnIndex == -1)
     {
         return;
     }
     this.SetCheckBoxState();
 }
Esempio n. 2
0
 private void GridControl_RowsChanged(object sender, GridViewCollectionChangedEventArgs e)
 {
     if (e.Action != NotifyCollectionChangedAction.Add || this.ColumnInfo == null || !((GridViewCheckBoxColumn)this.ColumnInfo).EnableHeaderCheckBox)
     {
         return;
     }
     this.SetCheckBoxState();
 }
Esempio n. 3
0
 private void radGridView1_RowsChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e)
 {
     if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Reset || e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Move)
     {
         foreach (GridViewRowInfo row in radGridView1.Rows)
         {
             row.Cells["noRow"].Value = row.Index + 1;
         }
     }
 }
Esempio n. 4
0
        internal static void RaiseGroupByChanged(
            GridViewTemplate template,
            GroupDescriptor groupDescription,
            NotifyCollectionChangedAction action)
        {
            GridGroupByExpression fromDescriptor = GridGroupByExpression.CreateFromDescriptor(groupDescription);

            template.EventDispatcher.ResumeEvent(EventDispatcher.GroupByChanging);
            template.EventDispatcher.ResumeEvent(EventDispatcher.GroupByChanged);
            if (action != NotifyCollectionChangedAction.Add && action != NotifyCollectionChangedAction.ItemChanged && (action != NotifyCollectionChangedAction.Batch && action != NotifyCollectionChangedAction.Remove))
            {
                throw new ArgumentException("Invalid action");
            }
            template.MasterTemplate.SynchronizationService.EndDispatch(true);
            GridViewCollectionChangedEventArgs args = new GridViewCollectionChangedEventArgs(template, action, (object)fromDescriptor, (object)null, 0, string.Empty);

            template.EventDispatcher.RaiseEvent <GridViewCollectionChangedEventArgs>(EventDispatcher.GroupByChanged, (object)template, args);
        }
Esempio n. 5
0
 internal virtual object this[GridViewColumn column]
 {
     get
     {
         if (this.IsAttached)
         {
             return(column.Accessor[this]);
         }
         if (this.rowState == null)
         {
             return((object)null);
         }
         return(this.Cache[column]);
     }
     set
     {
         bool flag = this.ViewTemplate.MasterTemplate != null && this.ViewTemplate.MasterTemplate.VirtualMode;
         if (!flag && !this.AddingNewDataRow && !this.ViewTemplate.IsUpdating)
         {
             GridViewCollectionChangingEventArgs args = new GridViewCollectionChangingEventArgs(this.ViewTemplate, Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanging, (object)this, (object)this, this.Index, new PropertyChangingEventArgsEx(column.FieldName, this[column], value));
             this.ViewTemplate.EventDispatcher.RaiseEvent <GridViewCollectionChangingEventArgs>(EventDispatcher.RowsChanging, (object)this, args);
             if (args.Cancel)
             {
                 return;
             }
         }
         if (this.IsAttached)
         {
             column.Accessor[this] = value;
         }
         else
         {
             this.Cache[column] = value;
             if (flag || this.IsSystem)
             {
                 return;
             }
             GridViewCollectionChangedEventArgs args = new GridViewCollectionChangedEventArgs(this.ViewTemplate, Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanged, (object)this, (object)this, this.Index, column.FieldName);
             this.ViewTemplate.EventDispatcher.RaiseEvent <GridViewCollectionChangedEventArgs>(EventDispatcher.RowsChanged, (object)this, args);
         }
     }
 }
 private void dgv_imageList_RowStateChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e)
 {
 }
Esempio n. 7
0
        private void ListSource_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                this.AttachRows(e.NewItems);
                if (!this.suspendNotifications)
                {
                    if (this.Count <= 1)
                    {
                        this.owner.DataView.EnsureDescriptors();
                    }
                    this.UpdateChildRowViewInfo((GridViewRowInfo)e.NewItems[0]);
                    if (((GridViewRowInfo)e.NewItems[0]).Parent is MasterGridViewTemplate)
                    {
                        ++((GridViewRowInfo)e.NewItems[0]).ViewInfo.Version;
                    }
                    this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.Add, e.NewItems));
                    if (this.owner.SelectLastAddedRow && e.NewItems.Count > 0)
                    {
                        GridViewSynchronizationService.RaiseCurrentChanged(this.owner, this.owner.DataView.CurrentItem, this.owner.CurrentColumn, this.owner.DataView == null);
                        if (!this.addingThroughUI)
                        {
                            if (this.prevSelectedRow != null)
                            {
                                GridViewSynchronizationService.SuspendEvent(this.owner, KnownEvents.CurrentChanged);
                                this.prevSelectedRow.IsCurrent  = false;
                                this.prevSelectedRow.IsSelected = false;
                                GridViewSynchronizationService.ResumeEvent(this.owner, KnownEvents.CurrentChanged);
                            }
                            GridViewRowInfo newItem = (GridViewRowInfo)e.NewItems[0];
                            newItem.IsCurrent    = true;
                            newItem.IsSelected   = true;
                            this.prevSelectedRow = newItem;
                            newItem.EnsureVisible();
                        }
                    }
                    if (this.owner.IsSelfReference)
                    {
                        this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.SortingChanged));
                    }
                }
            }
            GridViewInfo    gridViewInfo    = (GridViewInfo)null;
            GridViewRowInfo gridViewRowInfo = (GridViewRowInfo)null;
            bool            flag1           = false;

            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                GridViewRowInfo newItem = e.NewItems[0] as GridViewRowInfo;
                flag1 = newItem.IsPinned;
                if (newItem != null && newItem.ViewTemplate != null && newItem.ViewTemplate.HierarchyDataProvider != null)
                {
                    int val1 = this.owner.MasterTemplate.Owner.TableElement.RowScroller.Scrollbar.Value;
                    newItem.ViewTemplate.HierarchyDataProvider.Refresh();
                    newItem.ViewTemplate.Refresh();
                    RadScrollBarElement scrollbar = this.owner.MasterTemplate.Owner.TableElement.RowScroller.Scrollbar;
                    scrollbar.Value = Math.Min(val1, scrollbar.Maximum - scrollbar.LargeChange + 1);
                }
                if (newItem != null && newItem.IsCurrent && (this.owner.Parent != null && !this.suspendNotifications))
                {
                    gridViewInfo    = newItem.ViewInfo;
                    gridViewRowInfo = GridViewRowCollection.NavigateAfterRemove(newItem, (List <GridViewRowInfo>)null);
                }
                if (!this.suspendNotifications)
                {
                    this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.Remove, e.NewItems));
                }
            }
            this.OnCollectionChanged(e);
            if (gridViewInfo != null)
            {
                GridViewRelationDataProvider hierarchyDataProvider = gridViewInfo.ViewTemplate.HierarchyDataProvider as GridViewRelationDataProvider;
                if (hierarchyDataProvider != null && this.owner.MasterTemplate.SynchronizationService.IsDispatchSuspended)
                {
                    hierarchyDataProvider.Refresh();
                }
                gridViewInfo.Refresh();
            }
            GridViewCollectionChangedEventArgs args = new GridViewCollectionChangedEventArgs(this.owner, e.Action, e.NewItems, e.OldItems, e.NewStartingIndex, e.OldStartingIndex, e.PropertyName);
            bool flag2 = true;

            if (e.Action == NotifyCollectionChangedAction.ItemChanging || e.Action == NotifyCollectionChangedAction.ItemChanged)
            {
                flag2 = !this.owner.ListSource.IsDataBound || e.Action == NotifyCollectionChangedAction.ItemChanged && !string.IsNullOrEmpty(e.PropertyName);
            }
            if (flag2)
            {
                this.owner.EventDispatcher.RaiseEvent <GridViewCollectionChangedEventArgs>(EventDispatcher.RowsChanged, (object)this, args);
                this.UpdateHierarchyView(e.NewItems, e.PropertyName);
            }
            if (flag1)
            {
                this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.Remove), GridEventType.UI);
            }
            if (gridViewInfo == null || this.owner.MasterTemplate == null)
            {
                return;
            }
            if (this.owner.MasterTemplate.SynchronizationService.IsDispatchSuspended)
            {
                if (gridViewRowInfo == null)
                {
                    return;
                }
                this.owner.MasterTemplate.CurrentRowToSetOnEndUpdate = gridViewRowInfo;
            }
            else
            {
                if (!flag1)
                {
                    this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.Remove), GridEventType.UI);
                }
                if (gridViewRowInfo == null)
                {
                    return;
                }
                this.owner.MasterTemplate.CurrentRow = gridViewRowInfo;
            }
        }
 private void EditorControl_SortChanged(object sender, GridViewCollectionChangedEventArgs e)
 {
     this.OwnerComboItem.CallOnSortedChanged(new EventArgs());
 }