Ejemplo n.º 1
0
        public override void SelectRow(int row, bool select)
        {
            Range rowRange = Grid.Rows.GetRange(row);

            if (select && mList.IsSelectedRow(row) == false)
            {
                mList.AddRange(rowRange);
                OnSelectionChanged(new RangeRegionChangedEventArgs(rowRange, Range.Empty));
            }
            else
            if (!select && mList.IsSelectedRow(row))
            {
                mList.RemoveRange(rowRange);
                OnSelectionChanged(new RangeRegionChangedEventArgs(Range.Empty, rowRange));
            }
        }
Ejemplo n.º 2
0
        public override void SelectRow(int row, bool select)
        {
            // AlanP: Sep 2013.  Two small but significant code changes here...
            Range rowRange = Grid.Rows.GetRange(row);

            if (select && mList.IsSelectedRow(row) == false)
            {
                // if multi selection is false, remove all previously selected rows
                // AlanP: Sep 2013.  No need for this line now - see below
                // var activePosition = this.ActivePosition;
                if (this.EnableMultiSelection == false)
                {
                    this.Grid.Selection.ResetSelection(false, true);                        // AlanP: Sep 2013 - don't propagate events from this reset
                }
                // continue with adding selection
                mList.AddRange(rowRange);

                // AlanP: Sep 2013.  The active position is now set to the specified row
                // Prior to this change it was set to the value it had on entry, which was often Empty
                //   because ResetSelection was called just before this call.
                // AlanP: Oct 2013.  Added the code that sets (preserves) the column as well as the row.  Previous Sep 2013 fix always set column to 0
                int column = -1;
                if (row >= 0)
                {
                    column = ActivePosition.IsEmpty() ? 0 : ActivePosition.Column;
                }
                this.ActivePosition = new Position(row, column);

                if (!m_SuppressSelectionChangedEvent)
                {
                    OnSelectionChanged(new RangeRegionChangedEventArgs(rowRange, Range.Empty));
                }
            }
            else
            if (!select && mList.IsSelectedRow(row))
            {
                mList.RemoveRange(rowRange);
                OnSelectionChanged(new RangeRegionChangedEventArgs(Range.Empty, rowRange));
            }
        }
Ejemplo n.º 3
0
        public override void SelectRow(int row, bool select)
        {
            Range rowRange = Grid.Rows.GetRange(row);

            if (select && mList.IsSelectedRow(row) == false)
            {
                // if multi selection is false, remove all previously selected rows
                var activePosition = this.ActivePosition;
                if (this.EnableMultiSelection == false)
                {
                    this.Grid.Selection.ResetSelection(false);
                }
                // continue with adding selection
                mList.AddRange(rowRange);
                this.ActivePosition = activePosition;
                OnSelectionChanged(new RangeRegionChangedEventArgs(rowRange, Range.Empty));
            }
            else
            if (!select && mList.IsSelectedRow(row))
            {
                mList.RemoveRange(rowRange);
                OnSelectionChanged(new RangeRegionChangedEventArgs(Range.Empty, rowRange));
            }
        }
Ejemplo n.º 4
0
		public void AddRange_Merge_WhenOverlapped()
		{
			// single addition causes to range many rows at once
			
			// add separate ranges
			RangeMergerByRows list = new RangeMergerByRows()
				.AddRange(new Range(1, 1, 1, 1))
				.AddRange(new Range(3, 3, 3, 3))
				.AddRange(new Range(5, 5, 5, 5));
			
			Assert.AreEqual(3, list.GetSelectedRowRegions(0, 1).Count);
			
			// cause them all to merge
			list.AddRange(new Range(1, 1, 5, 1));
			Assert.AreEqual(1, list.GetSelectedRowRegions(0, 1).Count);
			
		}