protected virtual void OnSelectionChanged() { SelectionRegion selectedRegion = this.SelectedRegion; this.boundingRegion = !this.HasSelection ? SelectionRegion.Empty : (!(this.boundingRegion != SelectionRegion.Empty) ? this.SelectedRegion : new SelectionRegion(Math.Min(this.boundingRegion.Top, selectedRegion.Top), Math.Min(this.boundingRegion.Left, selectedRegion.Left), Math.Max(this.boundingRegion.Bottom, selectedRegion.Bottom), Math.Max(this.boundingRegion.Right, selectedRegion.Right), selectedRegion.ViewInfo)); if (this.SelectionChanged == null) { return; } this.SelectionChanged((object)this, EventArgs.Empty); }
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(); }
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(); }
public void AddSelectedRegions(SelectionRegion selectionRegion) { this.regions.Add(selectionRegion); }