本文整理汇总了C#中System.Windows.Automation.Peers.IViewAutomationPeer接口的典型用法代码示例。如果您正苦于以下问题:C# IViewAutomationPeer接口的具体用法?C# IViewAutomationPeer怎么用?C# IViewAutomationPeer使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。
IViewAutomationPeer接口属于System.Windows.Automation.Peers命名空间,在下文中一共展示了IViewAutomationPeer接口的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAutomationPeer
public class OneButtonHeaderView : ViewBase
{
protected override IViewAutomationPeer GetAutomationPeer(ListView parent)
{
return new OneButtonHeaderViewAutomationPeer( this, parent );
}
示例2: OneButtonHeaderViewAutomationPeer
public class OneButtonHeaderViewAutomationPeer : IViewAutomationPeer
{
ListView m_lv;
public OneButtonHeaderViewAutomationPeer(OneButtonHeaderView control, ListView parent)
{
m_lv = parent;
}
ItemAutomationPeer IViewAutomationPeer.CreateItemAutomationPeer(Object item)
{
ListViewAutomationPeer lvAP = UIElementAutomationPeer.FromElement(m_lv) as ListViewAutomationPeer;
return new ListBoxItemAutomationPeer(item, lvAP);
}
AutomationControlType IViewAutomationPeer.GetAutomationControlType()
{
return AutomationControlType.List;
}
List<AutomationPeer> IViewAutomationPeer.GetChildren(List<AutomationPeer> children)
{
// the children parameter is a list of automation peers for all the known items
// our view must add its banner button peer to this list.
Button b = (Button)m_lv.Template.FindName("BannerButton", m_lv);
AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(b);
//If children is null, we still need to create an empty list to insert the button
children ??= new List<AutomationPeer>();
children.Insert(0, peer);
return children;
}
Object IViewAutomationPeer.GetPattern(PatternInterface patternInterface)
{
// we can invoke the banner button
if (patternInterface == PatternInterface.Invoke)
{
Button b = (Button)m_lv.Template.FindName("BannerButton", m_lv);
AutomationPeer peer = UIElementAutomationPeer.FromElement(b);
if (peer != null)
return peer;
}
// if this view does not have special handling for the pattern interface, return null
// the ListViewAutomationPeer.GetPattern default handling will be used.
return null;
}
void IViewAutomationPeer.ItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { }
void IViewAutomationPeer.ViewDetached() { }
}