private void dataGrid_QueryCoveredRange(object sender, Syncfusion.UI.Xaml.Grid.GridQueryCoveredRangeEventArgs e) { var range = GetRange(e.GridColumn, e.RowColumnIndex.RowIndex, e.RowColumnIndex.ColumnIndex, e.Record); if (range == null) { return; } e.Range = range; e.Handled = true; }
/// <summary> /// Method to handle the QueryCoveredRange event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSfDataGridQueryCoveredRange(object sender, Syncfusion.UI.Xaml.Grid.GridQueryCoveredRangeEventArgs e) { if (!e.GridColumn.MappingName.Equals("CustomerID")) { return; } // Merging cells for flat grid var range = GetRange(e.GridColumn, e.RowColumnIndex.RowIndex, e.RowColumnIndex.ColumnIndex, e.Record); if (range == null) { return; } e.Range = range; e.Handled = true; }
/// <summary> /// Get covered cell info through event. /// </summary> /// <param name="rowIndex"></param> /// <param name="columnIndex"></param> /// <param name="gridColumn"></param> /// <param name="record"></param> /// <returns></returns> internal CoveredCellInfo GetCoveredCell(int rowIndex, int columnIndex, GridColumn gridColumn, object record) { if ((dataGrid.SelectionMode != GridSelectionMode.Single && dataGrid.SelectionMode != GridSelectionMode.None) || dataGrid.SelectionUnit == GridSelectionUnit.Row || dataGrid.SelectionUnit == GridSelectionUnit.Any || dataGrid.NavigationMode == NavigationMode.Row || dataGrid.AllowFrozenGroupHeaders) { throw new NotSupportedException(string.Format("Merged Cell will not support with {0}, {1}, {2}, AllowFrozenGroupedHeaders {3}", dataGrid.SelectionMode, dataGrid.SelectionUnit, dataGrid.NavigationMode, dataGrid.AllowFrozenGroupHeaders)); } CoveredCellInfo range = null; if (dataGrid.GridModel == null) { return(range); } GetCoveredCellInfo(out range, rowIndex, columnIndex); if (range != null) { return(range); } GridQueryCoveredRangeEventArgs e = new GridQueryCoveredRangeEventArgs(new RowColumnIndex(rowIndex, columnIndex), gridColumn, record, dataGrid); dataGrid.RaiseQueryCoveredRange(e); range = e.Range; if (range != null && e.Handled) { if (range.Contains(rowIndex, columnIndex)) { if (IsInRange(range)) { throw new Exception(String.Format("Conflict detected when trying to save {0}", range)); } range.MappedRowColumnIndex = new RowColumnIndex(range.Top, columnIndex); this.dataGrid.coveredCells.Add(range); return(range); } } return(null); }
/// <summary> /// Method to handle the QueryCoveredRange event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSfGridQueryCoveredRange(object sender, Syncfusion.UI.Xaml.Grid.GridQueryCoveredRangeEventArgs e) { // Merging cells for flat grid var range = GetRange(e.GridColumn, e.RowColumnIndex.RowIndex, e.RowColumnIndex.ColumnIndex, e.Record); if (range == null) { return; } // While editing we need to remove the range. if (this.sfGrid.CoveredCells.IsInRange(range)) { var coveredCellInfo = this.sfGrid.GetConflictRange(range); if (isEditted) { this.sfGrid.CoveredCells.Remove(coveredCellInfo); isEditted = false; } } e.Range = range; e.Handled = true; }