/// <summary> /// Invokes event /// </summary> protected virtual void OnCellSelection(CellElement oldCell, CellElement newCell) { if (CellSelection != null) { CellSelection(oldCell, newCell); } }
/// <summary> /// Dispatches appropriate events and performs row selection in the grid /// </summary> public virtual void DispatchCellSelection(CellElement cell) { if (cell.Row != null) { if (!m_MultiSelect) { SelectRow(cell.Row); } else //multiselect { if (!m_MultiSelectWithCtrl || (Control.ModifierKeys & Keys.Control) > 0) { if (IsRowSelected(cell.Row)) { UnSelectRow(cell.Row); } else { SelectRow(cell.Row); } } } } if (m_CellSelectionAllowed) { try { rebuildAllCells(true);//must force the rebuild or event will be invalid OnCellSelection(m_SelectedCell, cell); }finally{ m_SelectedCell = cell; } } }
/// <summary> /// Dispatches appropriate events and performs row selection in the grid /// </summary> public virtual void DispatchCellSelection(CellElement cell) { foreach (var col in m_Grid.m_Columns) { col.m_HasCellSelection = false; } if (m_Grid.CellSelectionAllowed) { m_HasCellSelection = true; OnCellSelection(m_Grid.SelectedCell, cell); } m_Grid.DispatchCellSelection(cell); }
private void rebuildAllCells(bool force)//true to force rebuild inspite of Begin/End Change { if (!force && m_BatchChangeCounter > 0) { m_BatchChangeNeedsRebuild = true; return; } try { if (m_CellView == null) { return; } if (m_Disposed) { return; } //forget all previously selected cells m_SelectedCell = null; m_CommentElement = null; m_CellView.DeleteAllElements(); buildCells(); } finally { if (!force) { m_BatchChangeNeedsRebuild = false; } } }
/// <summary> /// Invokes cell selection event /// </summary> protected virtual void OnCellSelection(CellElement oldCell, CellElement newCell) { if (CellSelection!=null) CellSelection(oldCell, newCell); }
/// <summary> /// Dispatches appropriate events and performs row selection in the grid /// </summary> public virtual void DispatchCellSelection(CellElement cell) { if (cell.Row!=null) { if (!m_MultiSelect) SelectRow(cell.Row); else //multiselect { if ((Control.ModifierKeys & Keys.Shift) > 0) { if (!SelectedRows.Any()) { SelectRow(cell.Row); return; } var first = m_RowMap.FindIndex(re => re.Row == SelectedRows.First()); var last = m_RowMap.FindIndex(re => re.Row == SelectedRows.Last()); var cur = m_RowMap.FindIndex(re => re.Row == cell.Row); if (cur < 0) return; UnSelectAllRows(); if (last <= cur) for (var i=last; i <= cur; ++i) SelectRow(m_RowMap[i].Row); else if (cur <= first) for (var i = cur; i <= first; ++i) SelectRow(m_RowMap[i].Row); } else if (!m_MultiSelectWithCtrl || (Control.ModifierKeys & Keys.Control) > 0) { if (IsRowSelected(cell.Row)) UnSelectRow(cell.Row); else SelectRow(cell.Row); } else { UnSelectAllRows(); SelectRow(cell.Row); } } } if (m_CellSelectionAllowed) try { rebuildAllCells(true);//must force the rebuild or event will be invalid OnCellSelection(m_SelectedCell, cell); }finally{ m_SelectedCell = cell; } }
private void rebuildAllCells(bool force)//true to force rebuild inspite of Begin/End Change { if (!force && m_BatchChangeCounter>0) { m_BatchChangeNeedsRebuild = true; return; } try { if (m_CellView==null) return; if (m_Disposed) return; //forget all previously selected cells m_SelectedCell = null; m_CommentElement = null; m_CellView.DeleteAllElements(); buildCells(); } finally { if (!force) m_BatchChangeNeedsRebuild = false; } }
/// <summary> /// Dispatches appropriate events and performs row selection in the grid /// </summary> public virtual void DispatchCellSelection(CellElement cell) { if (cell.Row!=null) { if (!m_MultiSelect) SelectRow(cell.Row); else //multiselect { if (!m_MultiSelectWithCtrl || (Control.ModifierKeys&Keys.Control) >0) { if (IsRowSelected(cell.Row)) UnSelectRow(cell.Row); else SelectRow(cell.Row); } } } if (m_CellSelectionAllowed) try { rebuildAllCells(true);//must force the rebuild or event will be invalid OnCellSelection(m_SelectedCell, cell); }finally{ m_SelectedCell = cell; } }
/// <summary> /// Dispatches appropriate events and performs row selection in the grid /// </summary> public virtual void DispatchCellSelection(CellElement cell) { if (cell.Row != null) { if (!m_MultiSelect) { if ((Control.ModifierKeys & Keys.Control) > 0) { UnSelectRow(cell.Row); } else { SelectRow(cell.Row); } } else //multiselect { if ((Control.ModifierKeys & Keys.Shift) > 0) { if (!SelectedRows.Any()) { SelectRow(cell.Row); return; } var first = m_RowMap.FindIndex(re => re.Row == SelectedRows.First()); var last = m_RowMap.FindIndex(re => re.Row == SelectedRows.Last()); var cur = m_RowMap.FindIndex(re => re.Row == cell.Row); if (cur < 0) { return; } UnSelectAllRows(); if (last <= cur) { for (var i = last; i <= cur; ++i) { SelectRow(m_RowMap[i].Row); } } else if (cur <= first) { for (var i = cur; i <= first; ++i) { SelectRow(m_RowMap[i].Row); } } } else if (!m_MultiSelectWithCtrl || (Control.ModifierKeys & Keys.Control) > 0) { if (IsRowSelected(cell.Row)) { UnSelectRow(cell.Row); } else { SelectRow(cell.Row); } } else { UnSelectAllRows(); SelectRow(cell.Row); } } } if (m_CellSelectionAllowed) { try { rebuildAllCells(true);//must force the rebuild or event will be invalid OnCellSelection(m_SelectedCell, cell); }finally{ m_SelectedCell = cell; } } }
internal ColumnResizeElement(CellView host, CellElement headerCell) : base(host) { m_HeaderCell = headerCell; m_Grid = m_HeaderCell.Column.Grid; }
private void grid_CellSelection(CellElement oldCell, CellElement newCell) { if (newCell==null) return; if (newCell.Row==null) return; Text = newCell.Column.RepresentValueAsString(newCell.Row, newCell.Column.GetValueFromRow(newCell.Row)); }