本文整理汇总了C#中System.Windows.UIElement.GetAutomationPeer方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.GetAutomationPeer方法的具体用法?C# UIElement.GetAutomationPeer怎么用?C# UIElement.GetAutomationPeer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.UIElement
的用法示例。
在下文中一共展示了UIElement.GetAutomationPeer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromElement
///
public static AutomationPeer FromElement(UIElement element)
{
if(element == null)
{
throw new ArgumentNullException("element");
}
return element.GetAutomationPeer();
}
示例2: InvalidateAutomationPeer
internal static bool InvalidateAutomationPeer(
DependencyObject o,
out UIElement e,
out ContentElement ce,
out UIElement3D e3d)
{
e = null;
ce = null;
e3d = null;
AutomationPeer ap = null;
e = o as UIElement;
if (e != null)
{
if (e.HasAutomationPeer == true)
ap = e.GetAutomationPeer();
}
else
{
ce = o as ContentElement;
if (ce != null)
{
if (ce.HasAutomationPeer == true)
ap = ce.GetAutomationPeer();
}
else
{
e3d = o as UIElement3D;
if (e3d != null)
{
if (e3d.HasAutomationPeer == true)
ap = e3d.GetAutomationPeer();
}
}
}
if (ap != null)
{
ap.InvalidateAncestorsRecursive();
// Check for parent being non-null while stopping as we don't want to stop in between due to peers not connected to AT
// those peers sometimes gets created to serve for various patterns.
// e.g: ScrollViewAutomationPeer for Scroll Pattern in case of ListBox.
if (ap.GetParent() != null)
return false;
}
return true;
}