private void ScrollToCell(Rect targetCell) { double deltaX = 0; double deltaY = 0; if (targetCell.Left < 0) { deltaX = targetCell.Left; } else if (this.ActualWidth < targetCell.Right) { deltaX = targetCell.Right - (this.ActualWidth); } if (targetCell.Top < 0) { deltaY = targetCell.Top; } else if (this.ActualHeight < targetCell.Bottom) { deltaY = targetCell.Bottom - (this.ActualHeight); } double resHorOffset = Math.Max(0, MainScrollView.HorizontalOffset + deltaX); double resVertOffset = Math.Max(0, MainScrollView.VerticalOffset + deltaY); MainScrollView.ScrollToHorizontalOffset(resHorOffset); MainScrollView.ScrollToVerticalOffset(resVertOffset); }