/// <summary> /// Gets the control pattern for the AutoCompleteBox that is associated /// with this AutoCompleteBoxAutomationPeer. /// </summary> /// <param name="patternInterface">The desired PatternInterface.</param> /// <returns>The desired AutomationPeer or null.</returns> public override object GetPattern(PatternInterface patternInterface) { object iface = null; AutoCompleteBox owner = OwnerAutoCompleteBox; if (patternInterface == PatternInterface.Value) { iface = this; } else if (patternInterface == PatternInterface.ExpandCollapse) { iface = this; } else { AutomationPeer peer = owner.SelectionAdapter?.CreateAutomationPeer(); if (peer != null) { iface = peer.GetPattern(patternInterface); } } // ReSharper disable ConvertIfStatementToNullCoalescingExpression if (iface == null) // ReSharper restore ConvertIfStatementToNullCoalescingExpression { iface = base.GetPattern(patternInterface); } return(iface); }
public GridTable (Adapter adapter, AutomationPeer peer) : base (adapter, peer) { this.peer = peer; this.tableProvider = (ITableProvider) peer.GetPattern ( PatternInterface.Table); }
/// <summary> /// Gets the control pattern for the AutoCompleteBox that is associated /// with this AutoCompleteBoxAutomationPeer. /// </summary> /// <param name="patternInterface">The desired PatternInterface.</param> /// <returns>The desired AutomationPeer or null.</returns> public override object GetPattern(PatternInterface patternInterface) { object iface = null; AutoCompleteBox owner = OwnerAutoCompleteBox; if (patternInterface == PatternInterface.Value) { iface = this; } else if (patternInterface == PatternInterface.ExpandCollapse) { iface = this; } else if (owner.SelectionAdapter != null) { AutomationPeer peer = owner.SelectionAdapter.CreateAutomationPeer(); if (peer != null) { iface = peer.GetPattern(patternInterface); } } if (iface == null) { iface = base.GetPattern(patternInterface); } return(iface); }
public Selection (Adapter adapter, AutomationPeer peer) : base (adapter, peer) { this.selectionProvider = (ISelectionProvider) peer.GetPattern ( PatternInterface.Selection); adapter.AutomationPropertyChanged += (o, args) => { if (args.Property == SelectionPatternIdentifiers.SelectionProperty) adapter.EmitSignal ("selection_changed"); }; }
public RangeValue (Adapter adapter, AutomationPeer peer) : base (adapter, peer) { this.rangeValueProvider = (IRangeValueProvider) peer.GetPattern ( PatternInterface.RangeValue); adapter.AutomationPropertyChanged += new EventHandler<AutomationPropertyChangedEventArgs> ( OnAutomationPropertyChanged); }
internal static new object GetSupportedPropertyValueInternal(AutomationPeer itemPeer, int propertyId) { if (SelectionItemPatternIdentifiers.IsSelectedProperty.Id == propertyId) { ISelectionItemProvider selectionItem = itemPeer.GetPattern(PatternInterface.SelectionItem) as ISelectionItemProvider; if (selectionItem != null) return selectionItem.IsSelected; else return null; } return ItemsControlAutomationPeer.GetSupportedPropertyValueInternal(itemPeer, propertyId); }
// Token: 0x060027ED RID: 10221 RVA: 0x000BB1B4 File Offset: 0x000B93B4 internal new static object GetSupportedPropertyValueInternal(AutomationPeer itemPeer, int propertyId) { if (SelectionItemPatternIdentifiers.IsSelectedProperty.Id != propertyId) { return(ItemsControlAutomationPeer.GetSupportedPropertyValueInternal(itemPeer, propertyId)); } ISelectionItemProvider selectionItemProvider = itemPeer.GetPattern(PatternInterface.SelectionItem) as ISelectionItemProvider; if (selectionItemProvider != null) { return(selectionItemProvider.IsSelected); } return(null); }
public override object GetPattern(PatternInterface patternInterface) { if (patternInterface == PatternInterface.Scroll) { ScrollViewer patternImplementor = ScrollPatternImplementor; if (patternImplementor != null) { AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(patternImplementor); return(peer.GetPattern(patternInterface)); } return(null); } return(base.GetPattern(patternInterface)); }
private static bool TryInvokePatternAutomation(AutomationPeer peer) { var pattern = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; if (pattern == null) return false; try { pattern.Invoke(); } catch (Exception exception) { throw new TestAutomationException("Exception while invoking pattern", exception); } return true; }
/// <summary> /// Tries the toggle pattern automation. /// </summary> /// <param name="peer">The peer.</param> /// <param name="element">The element.</param> /// <returns> /// True if the pattern was available and succeeded, else false. /// </returns> /// <exception cref="TestAutomationException">Exception while invoking pattern</exception> private static bool TryTogglePatternAutomation(AutomationPeer peer, UIElement element) { var pattern = peer.GetPattern(PatternInterface.Toggle) as IToggleProvider; if (pattern == null) { return false; } try { pattern.Toggle(); // Toggle won't fire the command, so do that manually! var te = element as ToggleButton; if (te != null && te.Command != null) { te.Command.Execute(te.CommandParameter); } } catch (Exception exception) { throw new TestAutomationException("Exception while invoking pattern", exception); } return true; }