public bool MoveTo(UniversalCellInfo targetCell) { if (inMoveTo.IsSet) { return(true); } return((bool)dataGrid.Dispatcher.Invoke(DispatcherPriority.Loaded, new Func <bool>(() => { bool canceled; log.DebugFormat("Moving to cell {0}", targetCell); UpdateCurrentCell(); if (!CanMoveTo(targetCell)) { return CannotMoveToCell(targetCell); } if (!suppressChangeNotifications.IsSet) { RaisePreviewCurrentCellChangingEvent(targetCell, out canceled); if (canceled) { return OperationCanceled(); } } using (isSelfInducedCellChange.Set()) { if (targetCell.CellIndex >= dataGrid.Columns.Count) { return false; } var rowEnumSvc = GetRowEnumerationServiceForItem(targetCell.Item); // If changing the row type (according to the row service), we should retake the cell index. if (CurrentRowCellEnumerationService == null || rowEnumSvc.ServiceGroupIdentifier.Equals(CurrentRowCellEnumerationService.ServiceGroupIdentifier)) { currentCellPosition.SetCurrentCellIndex(rowEnumSvc, targetCell.CellIndex); } var newCell = rowEnumSvc.GetCellInfo(currentCellPosition.GetCurrentCellIndex(rowEnumSvc)); var fm = UIServiceProvider.GetService <IFocusManagementService>(dataGrid); elementTraits.SetCurrentCell(this.dataGrid, newCell); UpdateCurrentCell(); fm.SetFocusOnTargetElement(); if (!suppressChangeNotifications.IsSet) { RaiseCurrentCellChangedEvent(); } } return CurrentCell.Equals(targetCell); }))); }