Beispiel #1
0
        public bool Remove(SelectionCellRange item)
        {
            DataGridContext  dataGridContext  = m_list.DataGridContext;
            SelectionManager selectionManager = dataGridContext.DataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                return(selectionManager.UnselectCells(dataGridContext, new SelectionCellRangeWithItems(item.ItemRange, null, item.ColumnRange)));
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }
        public bool Remove(object item)
        {
            DataGridContext  dataGridContext  = m_list.DataGridContext;
            SelectionManager selectionManager = dataGridContext.DataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                return(selectionManager.UnselectItems(dataGridContext, new SelectionRangeWithItems(SelectionRange.Empty, new object[] { item })));
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }
Beispiel #3
0
        public void Clear()
        {
            DataGridContext  dataGridContext  = m_list.DataGridContext;
            SelectionManager selectionManager = dataGridContext.DataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                selectionManager.UnselectAllCells(dataGridContext);
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }
        public void RemoveAt(int index)
        {
            if ((index < 0) || (index >= m_list.ItemsCount))
            {
                throw new ArgumentOutOfRangeException("index", index, "index must be greater than or equal to zero and less than Count.");
            }

            int oldIndexOffset = 0;
            int indexOffset    = 0;
            int count          = m_list.Count;
            SelectionRangeWithItems rangeWithItemsFound = SelectionRangeWithItems.Empty;

            for (int i = 0; i < count; i++)
            {
                SelectionRangeWithItems rangeWithItems = m_list[i];
                indexOffset += rangeWithItems.Length;

                if (index < indexOffset)
                {
                    rangeWithItemsFound = rangeWithItems; // .GetItem( dataGridContext, index - oldIndexOffset );
                    break;
                }

                oldIndexOffset = indexOffset;
            }

            if (!rangeWithItemsFound.IsEmpty)
            {
                DataGridContext  dataGridContext  = m_list.DataGridContext;
                SelectionManager selectionManager = dataGridContext.DataGridControl.SelectionChangerManager;
                selectionManager.Begin();

                try
                {
                    selectionManager.UnselectItems(dataGridContext,
                                                   new SelectionRangeWithItems(
                                                       rangeWithItemsFound.Range.GetIndexFromItemOffset(index - oldIndexOffset),
                                                       rangeWithItemsFound.GetItem(dataGridContext, index - oldIndexOffset)));
                }
                finally
                {
                    selectionManager.End(false, true, true);
                }
            }
        }
Beispiel #5
0
        public void Insert(int index, SelectionCellRange item)
        {
            if ((index < 0) || (index > m_list.Count))
            {
                throw new ArgumentOutOfRangeException("index", index, "index must be greater than or equal to zero and less than or equal to Count.");
            }

            DataGridContext  dataGridContext  = m_list.DataGridContext;
            SelectionManager selectionManager = dataGridContext.DataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                selectionManager.SelectCells(dataGridContext, new SelectionCellRangeWithItems(item.ItemRange, null, item.ColumnRange));
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }
        public void RemoveAt(int index)
        {
            if ((index < 0) || (index >= m_list.Count))
            {
                throw new ArgumentOutOfRangeException("index", index, "index must be greater than or equal to zero and less than Count.");
            }

            DataGridContext  dataGridContext  = m_list.DataGridContext;
            SelectionManager selectionManager = dataGridContext.DataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                selectionManager.UnselectItems(dataGridContext, new SelectionRangeWithItems(this[index], null));
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }
Beispiel #7
0
        public void Add(SelectionCellRange item)
        {
            DataGridContext dataGridContext = m_list.DataGridContext;
            DataGridControl dataGridControl = dataGridContext.DataGridControl;

            if (dataGridControl.SelectionUnit == SelectionUnit.Row)
            {
                throw new InvalidOperationException("Can't add cell range when SelectionUnit is Row.");
            }

            SelectionManager selectionManager = dataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                selectionManager.SelectCells(dataGridContext, new SelectionCellRangeWithItems(item.ItemRange, null, item.ColumnRange));
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }
        public void Add(SelectionRange item)
        {
            DataGridContext dataGridContext = m_list.DataGridContext;
            DataGridControl dataGridControl = dataGridContext.DataGridControl;

            if (dataGridControl.SelectionUnit == SelectionUnit.Cell)
            {
                throw new InvalidOperationException("Can't add item when SelectionUnit is Cell.");
            }

            SelectionManager selectionManager = dataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                selectionManager.SelectItems(dataGridContext, new SelectionRangeWithItems(item, null));
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }