예제 #1
0
 protected virtual void OnSelectionChanging(VirtualGridSelectionChangingEventArgs args)
 {
     if (this.SelectionChanging == null)
     {
         return;
     }
     this.SelectionChanging((object)this, args);
 }
예제 #2
0
        public void ClearSelection()
        {
            VirtualGridSelectionChangingEventArgs args = new VirtualGridSelectionChangingEventArgs(VirtualGridSelectionAction.ClearSelection, 0, 0, this.CurrentViewInfo);

            this.OnSelectionChanging(args);
            if (args.Cancel)
            {
                return;
            }
            this.ClearSelectedRegions();
            this.startRow       = this.endRow = this.startColumn = this.endColumn = -1;
            this.boundingRegion = SelectionRegion.Empty;
            this.OnSelectionChanged();
        }
예제 #3
0
        public void SelectAll()
        {
            if (!this.Multiselect)
            {
                return;
            }
            VirtualGridSelectionChangingEventArgs args = new VirtualGridSelectionChangingEventArgs(VirtualGridSelectionAction.SelectAll, 0, 0, this.CurrentViewInfo);

            this.OnSelectionChanging(args);
            if (args.Cancel)
            {
                return;
            }
            this.ClearSelectedRegions();
            this.startRow  = this.startColumn = 0;
            this.endRow    = this.CurrentViewInfo.RowCount - 1;
            this.endColumn = this.CurrentViewInfo.ColumnCount - 1;
            this.OnSelectionChanged();
        }
예제 #4
0
        public void ExtendCurrentRegion(int rowIndex, int columnIndex)
        {
            if ((this.SelectionMode != VirtualGridSelectionMode.FullRowSelect || this.endRow == rowIndex) && (this.SelectionMode != VirtualGridSelectionMode.CellSelect || this.endColumn == columnIndex && this.endRow == rowIndex))
            {
                return;
            }
            VirtualGridSelectionChangingEventArgs args = new VirtualGridSelectionChangingEventArgs(VirtualGridSelectionAction.ExtendSelection, rowIndex, columnIndex, this.CurrentViewInfo);

            this.OnSelectionChanging(args);
            if (args.Cancel)
            {
                return;
            }
            this.endRow = rowIndex;
            if (this.SelectionMode == VirtualGridSelectionMode.CellSelect)
            {
                this.endColumn = columnIndex;
            }
            else if (this.SelectionMode == VirtualGridSelectionMode.FullRowSelect)
            {
                this.endColumn = this.CurrentViewInfo.ColumnCount - 1;
            }
            this.OnSelectionChanged();
        }
예제 #5
0
        public void BeginSelection(
            int rowIndex,
            int columnIndex,
            VirtualGridViewInfo viewInfo,
            bool keepSelection)
        {
            keepSelection &= this.currentViewInfo == viewInfo;
            VirtualGridSelectionChangingEventArgs args = new VirtualGridSelectionChangingEventArgs(keepSelection ? VirtualGridSelectionAction.BeginSelection : VirtualGridSelectionAction.ClearAndBeginSelection, rowIndex, columnIndex, viewInfo);

            this.OnSelectionChanging(args);
            if (args.Cancel)
            {
                return;
            }
            if (!keepSelection)
            {
                this.ClearSelectedRegions();
                this.boundingRegion = SelectionRegion.Empty;
            }
            else
            {
                this.AddSelectedRegions(this.SelectedRegion);
            }
            this.currentViewInfo = viewInfo;
            this.startRow        = this.endRow = rowIndex;
            if (this.SelectionMode == VirtualGridSelectionMode.CellSelect)
            {
                this.startColumn = this.endColumn = columnIndex;
            }
            else if (this.SelectionMode == VirtualGridSelectionMode.FullRowSelect)
            {
                this.startColumn = 0;
                this.endColumn   = this.CurrentViewInfo.ColumnCount - 1;
            }
            this.OnSelectionChanged();
        }