本文整理汇总了C#中PatternInterface类的典型用法代码示例。如果您正苦于以下问题:C# PatternInterface类的具体用法?C# PatternInterface怎么用?C# PatternInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PatternInterface类属于命名空间,在下文中一共展示了PatternInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPattern
public override object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Value)
return this;
return base.GetPattern(patternInterface);
}
示例2: GetPattern
/// <summary>
/// <see cref="AutomationPeer.GetAutomationControlTypeCore"/>
/// </summary>
public override object GetPattern(PatternInterface patternInterface)
{
object returnValue = null;
if (patternInterface == PatternInterface.Text)
{
if (_textPattern == null)
{
if (Owner is IServiceProvider)
{
ITextContainer textContainer = ((IServiceProvider)Owner).GetService(typeof(ITextContainer)) as ITextContainer;
if (textContainer != null)
{
_textPattern = new TextAdaptor(this, textContainer);
}
}
}
returnValue = _textPattern;
}
else
{
returnValue = base.GetPattern(patternInterface);
}
return returnValue;
}
示例3: GetPattern
public override object GetPattern( PatternInterface patternInterface )
{
if( patternInterface == PatternInterface.ExpandCollapse )
return this;
return null;
}
示例4: GetPattern
public override object GetPattern(PatternInterface patternInterface)
{
// In .net4 ItemAutomationPeer implements VirtualizedItemPattern, then we would need to call base.GetPattern here.
object peer = null;
if (patternInterface == PatternInterface.ScrollItem)
{
peer = this;
}
else if (patternInterface == PatternInterface.ExpandCollapse)
{
// only if RibbonGroup is Collapsed this Pattern applies.
RibbonGroup wrapperGroup = GetWrapper();
if (wrapperGroup != null && wrapperGroup.IsCollapsed)
{
peer = this;
}
}
if (peer == null)
{
RibbonGroupAutomationPeer wrapperPeer = GetWrapperPeer();
if (wrapperPeer != null)
{
peer = wrapperPeer.GetPattern(patternInterface);
}
}
return peer;
}
示例5: GetPattern
/// <summary>
/// Gets the control pattern that is associated with the specified System.Windows.Automation.Peers.PatternInterface.
/// </summary>
/// <param name="patternInterface">A value from the System.Windows.Automation.Peers.PatternInterface enumeration.</param>
/// <returns>The object that supports the specified pattern, or null if unsupported.</returns>
public override object GetPattern(PatternInterface patternInterface)
{
switch (patternInterface)
{
case PatternInterface.Grid:
case PatternInterface.Selection:
case PatternInterface.Table:
return this;
case PatternInterface.Scroll:
{
ScrollViewer scrollViewer = this.OwningDataGrid.InternalScrollHost;
if (scrollViewer != null)
{
AutomationPeer scrollPeer = UIElementAutomationPeer.CreatePeerForElement(scrollViewer);
IScrollProvider scrollProvider = scrollPeer as IScrollProvider;
if (scrollPeer != null && scrollProvider != null)
{
scrollPeer.EventsSource = this;
return scrollProvider;
}
}
break;
}
}
return base.GetPattern(patternInterface);
}
示例6: GetPattern
///
override public object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.VirtualizedItem)
{
// Virtualization not supported for GriViewItem or when Grouping is enabled
if(VirtualizedItemPatternIdentifiers.Pattern != null && !(this is GridViewItemAutomationPeer) && !IsGroupingEnabled())
{
if(GetWrapperPeer() == null)
return this;
else
{
// ItemsControlAutomationPeer can be null in case of TreeViewItems when parent TreeViewItem is also virtualized
// If the Item is in Automation Tree we consider it has Realized and need not return VirtualizeItem pattern.
if(ItemsControlAutomationPeer != null && !IsItemInAutomationTree())
{
return this;
}
if(ItemsControlAutomationPeer == null)
return this;
}
}
return null;
}
else if(patternInterface == PatternInterface.SynchronizedInput)
{
UIElementAutomationPeer peer = GetWrapperPeer() as UIElementAutomationPeer;
if(peer != null)
{
return peer.GetPattern(patternInterface);
}
}
return null;
}
示例7: GetPattern
///
override public object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.ExpandCollapse)
{
return this;
}
else if (patternInterface == PatternInterface.SelectionItem)
{
return this;
}
else if (patternInterface == PatternInterface.ScrollItem)
{
return this;
}
else if ((patternInterface == PatternInterface.ItemContainer) || (patternInterface == PatternInterface.SynchronizedInput))
{
TreeViewItemAutomationPeer treeViewItemAutomationPeer = GetWrapperPeer() as TreeViewItemAutomationPeer;
if (treeViewItemAutomationPeer != null)
{
if(patternInterface == PatternInterface.SynchronizedInput)
{
return treeViewItemAutomationPeer.GetPattern(patternInterface);
}
else
{
return treeViewItemAutomationPeer;
}
}
}
return base.GetPattern(patternInterface);
}
示例8: GetPattern
public override object GetPattern (PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Scroll)
return this;
else
return base.GetPattern (patternInterface);
}
示例9: GetPattern
/// <summary>
/// Gets the control pattern that is associated with the specified System.Windows.Automation.Peers.PatternInterface.
/// </summary>
/// <param name="patternInterface">A value from the System.Windows.Automation.Peers.PatternInterface enumeration.</param>
/// <returns>The object that supports the specified pattern, or null if unsupported.</returns>
public override object GetPattern(PatternInterface patternInterface)
{
switch (patternInterface)
{
case PatternInterface.Invoke:
{
if (this.OwningHeader.Column != null && this.OwningHeader.Column.CanUserSort)
{
return this;
}
break;
}
case PatternInterface.ScrollItem:
{
return this;
}
case PatternInterface.Transform:
{
if (this.OwningHeader.Column != null && this.OwningHeader.Column.DataGridOwner.CanUserResizeColumns)
{
return this;
}
break;
}
}
return base.GetPattern(patternInterface);
}
示例10: GetPattern
/// <summary>
/// <see cref="AutomationPeer.GetPattern"/>
/// </summary>
override public object GetPattern(PatternInterface patternInterface)
{
object returnValue = null;
// Check if provided patternInterface is for Scroll, which is all
// that is currently exposed.
if (patternInterface == PatternInterface.Scroll)
{
// Get a reference to DocumentViewer's ScrollViewer
DocumentViewer owner = (DocumentViewer)Owner;
if (owner.ScrollViewer != null)
{
// Get a reference to ScrollViewer's AutomationPeer.
AutomationPeer scrollPeer = UIElementAutomationPeer.CreatePeerForElement(owner.ScrollViewer);
if (scrollPeer != null && scrollPeer is IScrollProvider)
{
scrollPeer.EventsSource = this;
returnValue = scrollPeer;
}
}
}
else
{
returnValue = base.GetPattern(patternInterface);
}
return returnValue;
}
示例11: GetPattern
public override object GetPattern (PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.SelectionItem)
return this;
return base.GetPattern (patternInterface);
}
示例12: GetPattern
///
override public object GetPattern(PatternInterface patternInterface)
{
object returnValue = null;
if(patternInterface == PatternInterface.Value)
returnValue = this;
if (patternInterface == PatternInterface.Text)
{
if(_textPattern == null)
_textPattern = new TextAdaptor(this, ((TextBoxBase)Owner).TextContainer);
return _textPattern;
}
if (patternInterface == PatternInterface.Scroll)
{
TextBox owner = (TextBox)Owner;
if (owner.ScrollViewer != null)
{
returnValue = owner.ScrollViewer.CreateAutomationPeer();
((AutomationPeer)returnValue).EventsSource = this;
}
}
if (patternInterface == PatternInterface.SynchronizedInput)
{
returnValue = base.GetPattern(patternInterface);
}
return returnValue;
}
示例13: GetPattern
/// <summary>
/// Return the patterns supported by PasswordBoxAutomationPeer
/// </summary>
/// <param name="patternInterface"></param>
/// <returns></returns>
override public object GetPattern(PatternInterface patternInterface)
{
object returnValue = null;
if (patternInterface == PatternInterface.Value)
{
returnValue = this;
}
else if (patternInterface == PatternInterface.Text)
{
if (_textPattern == null)
{
_textPattern = new TextAdaptor(this, ((PasswordBox)Owner).TextContainer);
}
returnValue = _textPattern;
}
else if (patternInterface == PatternInterface.Scroll)
{
PasswordBox owner = (PasswordBox)Owner;
if (owner.ScrollViewer != null)
{
returnValue = owner.ScrollViewer.CreateAutomationPeer();
((AutomationPeer)returnValue).EventsSource = this;
}
}
else
{
returnValue = base.GetPattern(patternInterface);
}
return returnValue;
}
示例14: GetPattern
///
override public object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Invoke)
return this;
else
return base.GetPattern(patternInterface);
}
示例15: GetPattern
///
override public object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.ScrollItem)
{
return this;
}
return base.GetPattern(patternInterface);
}