internal void UpdateEventSource()
        {
            DataGrid dataGrid = OwningDataGridRow.DataGridOwner;

            if (dataGrid != null)
            {
                DataGridAutomationPeer dataGridAutomationPeer = CreatePeerForElement(dataGrid) as DataGridAutomationPeer;
                if (dataGridAutomationPeer != null)
                {
                    AutomationPeer itemAutomationPeer = dataGridAutomationPeer.GetOrCreateItemPeer(OwningDataGridRow.Item);
                    if (itemAutomationPeer != null)
                    {
                        this.EventsSource = itemAutomationPeer;
                    }
                }
            }
        }
        private void UpdateEventSource()
        {
            DataGridCell cell     = (DataGridCell)Owner;
            DataGrid     dataGrid = cell.DataGridOwner;

            if (dataGrid != null)
            {
                DataGridAutomationPeer dataGridAutomationPeer = CreatePeerForElement(dataGrid) as DataGridAutomationPeer;
                if (dataGridAutomationPeer != null)
                {
                    DataGridItemAutomationPeer itemAutomationPeer = dataGridAutomationPeer.GetOrCreateItemPeer(cell.DataContext);
                    if (itemAutomationPeer != null)
                    {
                        DataGridCellItemAutomationPeer cellItemAutomationPeer = itemAutomationPeer.GetOrCreateCellItemPeer(cell.Column);
                        this.EventsSource = cellItemAutomationPeer;
                    }
                }
            }
        }
        IRawElementProviderSimple[] ITableItemProvider.GetRowHeaderItems()
        {
            if (this.OwningDataGrid != null &&
                (this.OwningDataGrid.HeadersVisibility & DataGridHeadersVisibility.Row) == DataGridHeadersVisibility.Row)
            {
                DataGridAutomationPeer     dataGridAutomationPeer     = UIElementAutomationPeer.CreatePeerForElement(this.OwningDataGrid) as DataGridAutomationPeer;
                DataGridItemAutomationPeer dataGridItemAutomationPeer = dataGridAutomationPeer.GetOrCreateItemPeer(_item);
                if (dataGridItemAutomationPeer != null)
                {
                    AutomationPeer rowHeaderAutomationPeer = dataGridItemAutomationPeer.RowHeaderAutomationPeer;
                    if (rowHeaderAutomationPeer != null)
                    {
                        List <IRawElementProviderSimple> providers = new List <IRawElementProviderSimple>(1);
                        providers.Add(ProviderFromPeer(rowHeaderAutomationPeer));
                        return(providers.ToArray());
                    }
                }
            }

            return(null);
        }