internal void RaiseAutomationInvokeEvents(DataGridEditingUnit editingUnit, DataGridColumn column, DataGridRow row) { switch (editingUnit) { case DataGridEditingUnit.Cell: { DataGridCell cell = row.Cells[column.Index]; AutomationPeer peer = FromElement(cell); if (peer != null) { peer.InvalidatePeer(); } else { peer = CreatePeerForElement(cell); } if (peer != null) { peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked); } break; } case DataGridEditingUnit.Row: { DataGridItemAutomationPeer peer = GetOrCreateItemPeer(row.DataContext); peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked); break; } } }