/// <summary>
 /// Returns a System.Windows.Point that represents the clickable space that is
 /// on the System.Windows.UIElement that is associated with this System.Windows.Automation.Peers.FrameworkElementAutomationPeer.
 /// This method is called by System.Windows.Automation.Peers.AutomationPeer.GetClickablePoint().
 /// </summary>
 /// <returns>The System.Windows.Point on the element that allows a click.</returns>
 protected override Point GetClickablePointCore()
 {
     // Return the clickable point of the page number TextBox when present.
     switch (this.OwningDataPager.DisplayMode)
     {
     case PagerDisplayMode.FirstLastPreviousNext:
     case PagerDisplayMode.PreviousNext:
         if (this.OwningDataPager.CurrentPageTextBox != null)
         {
             AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(this.OwningDataPager.CurrentPageTextBox);
             if (peer != null)
             {
                 peer.InvalidatePeer();
             }
             else
             {
                 peer = FrameworkElementAutomationPeer.CreatePeerForElement(this.OwningDataPager.CurrentPageTextBox);
             }
             if (peer != null)
             {
                 return(peer.GetClickablePoint());
             }
         }
         break;
     }
     return(base.GetClickablePointCore());
 }
Beispiel #2
0
        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)
                {
#if DEBUG_AUTOMATION
                    Debug.WriteLine(peer.ToString() + ".RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked)");
#endif
                    peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
                }

                break;
            }

            case DataGridEditingUnit.Row:
            {
                DataGridItemAutomationPeer peer = GetOrCreateItemPeer(row.DataContext);
#if DEBUG_AUTOMATION
                Debug.WriteLine("DataGridItemAutomationPeer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked)");
#endif
                peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
                break;
            }
            }
        }