示例#1
0
 ///<summary>
 /// This static helper creates an AutomationPeer for the specified element and
 /// caches it - that means the created peer is going to live long and shadow the
 /// element for its lifetime. The peer will be used by Automation to proxy the element, and
 /// to fire events to the Automation when something happens with the element.
 /// The created peer is returned from this method and also from subsequent calls to this method
 /// and <seealso cref="FromElement"/>. The type of the peer is determined by the
 /// <seealso cref="UIElement.OnCreateAutomationPeer"/> virtual callback. If FrameworkContentElement does not
 /// implement the callback, there will be no peer and this method will return 'null' (in other
 /// words, there is no such thing as a 'default peer').
 ///</summary>
 public static AutomationPeer CreatePeerForElement(ContentElement element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return(element.CreateAutomationPeer());
 }
 ///<summary>
 /// This static helper creates an AutomationPeer for the specified element and 
 /// caches it - that means the created peer is going to live long and shadow the 
 /// element for its lifetime. The peer will be used by Automation to proxy the element, and
 /// to fire events to the Automation when something happens with the element. 
 /// The created peer is returned from this method and also from subsequent calls to this method
 /// and <seealso cref="FromElement"/>. The type of the peer is determined by the
 /// <seealso cref="UIElement.OnCreateAutomationPeer"/> virtual callback. If FrameworkContentElement does not
 /// implement the callback, there will be no peer and this method will return 'null' (in other 
 /// words, there is no such thing as a 'default peer').
 ///</summary> 
 public static AutomationPeer CreatePeerForElement(ContentElement element) 
 {
     if (element == null) 
     {
         throw new ArgumentNullException("element");
     }
     return element.CreateAutomationPeer(); 
 }