本文整理汇总了C#中System.Windows.Automation.Peers.AutomationPeer类的典型用法代码示例。如果您正苦于以下问题:C# AutomationPeer类的具体用法?C# AutomationPeer怎么用?C# AutomationPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutomationPeer类属于System.Windows.Automation.Peers命名空间,在下文中一共展示了AutomationPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Calendar
public Calendar (Adapter adapter, AutomationPeer peer)
: base (adapter, peer)
{
FrameworkElementAutomationPeer feap = peer as FrameworkElementAutomationPeer;
if (feap == null)
return;
// XXX: We can't link to System.Windows.Controls, so
// we'll use reflection instead.
UIElement calendar = feap.Owner;
Type t = calendar.GetType ();
if (t.Namespace != "System.Windows.Controls" || t.Name != "Calendar")
return;
// XXX SUCH A HACK! XXX
// Workaround a bug in CalendarAutomationPeer.
// Even though its selection and NameProperty
// change, it does not send the proper change
// notifications via the peer. So we fake them.
EventInfo ei = t.GetEvent ("SelectedDatesChanged");
ei.AddEventHandler (calendar,
new EventHandler<SelectionChangedEventArgs> (OnSelectedDatesChanged));
}
示例2: BaseActionImplementor
public BaseActionImplementor (Adapter adapter, AutomationPeer peer)
: base (adapter, peer)
{
// TODO: also do this in response to patterns being
// added/removed
RefreshActions ();
}
示例3: ExpandCollapseInvokeToggle
public ExpandCollapseInvokeToggle (Adapter adapter, AutomationPeer peer)
: base (adapter, peer)
{
adapter.AutomationPropertyChanged
+= new EventHandler<AutomationPropertyChangedEventArgs> (
OnAutomationPropertyChanged);
}
示例4: RaisePropertyChangedEvent
public void RaisePropertyChangedEvent (AutomationPeer peer,
AutomationProperty property,
object oldValue,
object newValue)
{
if (!AccessibilityEnabled || peer == null)
return;
if (object.Equals (newValue, oldValue))
return;
// We are going to raise changes only when the value ACTUALLY CHANGES
IAutomationCacheProperty cachedProperty = peer.GetCachedProperty (property);
if (cachedProperty != null) {
if (object.Equals (newValue, cachedProperty.OldValue))
return;
cachedProperty.OldValue = newValue;
}
if (AutomationPropertyChanged != null)
AutomationPropertyChanged (this,
new AutomationPropertyChangedEventArgs (peer,
property,
oldValue,
newValue));
}
示例5: RadioButton
public RadioButton (Adapter adapter, AutomationPeer peer)
: base (adapter, peer)
{
adapter.AutomationPropertyChanged
+= new EventHandler<AutomationPropertyChangedEventArgs> (
OnAutomationPropertyChanged);
}
示例6: GridTable
public GridTable (Adapter adapter, AutomationPeer peer) : base (adapter, peer)
{
this.peer = peer;
this.tableProvider = (ITableProvider) peer.GetPattern (
PatternInterface.Table);
}
示例7: CategoryContainerAutomationPeer
// Private ctor called from two public, static accessors
private CategoryContainerAutomationPeer(CiderCategoryContainer container, AutomationPeer itemPeer)
{
Fx.Assert(container != null, "CategoryContainer not specified.");
Fx.Assert(itemPeer != null, "CategoryContainerItemAutomationPeer not specified.");
_container = container;
_itemAutomationPeer = itemPeer;
}
示例8: RaiseAutomationEvent
public void RaiseAutomationEvent (AutomationPeer peer, AutomationEvents eventId)
{
if (!AccessibilityEnabled || peer == null)
return;
if (AutomationEventRaised != null)
AutomationEventRaised (this, new AutomationEventEventArgs (peer, eventId));
}
示例9: Selection
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");
};
}
示例10: RangeValue
public RangeValue (Adapter adapter, AutomationPeer peer)
: base (adapter, peer)
{
this.rangeValueProvider = (IRangeValueProvider) peer.GetPattern (
PatternInterface.RangeValue);
adapter.AutomationPropertyChanged
+= new EventHandler<AutomationPropertyChangedEventArgs> (
OnAutomationPropertyChanged);
}
示例11: TextAdaptor
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
#region Constructors
/// <summary>
/// Constructor
/// </summary>
/// <param name="textPeer">Automation Peer representing element for the ui scope of the text</param>
/// <param name="textContainer">ITextContainer</param>
internal TextAdaptor(AutomationPeer textPeer, ITextContainer textContainer)
{
Invariant.Assert(textContainer != null, "Invalid ITextContainer");
Invariant.Assert(textPeer is TextAutomationPeer || textPeer is ContentTextAutomationPeer, "Invalid AutomationPeer");
_textPeer = textPeer;
_textContainer = textContainer;
_textContainer.Changed += new TextContainerChangedEventHandler(OnTextContainerChanged);
if (_textContainer.TextSelection != null)
{
_textContainer.TextSelection.Changed += new EventHandler(OnTextSelectionChanged);
}
}
示例12: GetSupportedPropertyValueInternal
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);
}
示例13: ElementProxy
//------------------------------------------------------
//
// Constructors
//
//------------------------------------------------------
#region Constructors
// private ctor - the Wrap() pseudo-ctor is used instead.
private ElementProxy(AutomationPeer peer)
{
if ((AutomationInteropReferenceType == ReferenceType.Weak) &&
(peer is UIElementAutomationPeer || peer is ContentElementAutomationPeer || peer is UIElement3DAutomationPeer))
{
_peer = new WeakReference(peer);
}
else
{
_peer = peer;
}
}
示例14: InteropAutomationProvider
internal InteropAutomationProvider(HostedWindowWrapper wrapper, AutomationPeer parent)
{
if (wrapper == null)
{
throw new ArgumentNullException("wrapper");
}
if (parent == null)
{
throw new ArgumentNullException("parent");
}
_wrapper = wrapper;
_parent = parent;
}
示例15: SelectionItem
public SelectionItem (Adapter adapter, AutomationPeer peer) : base (adapter, peer)
{
bool? isSelected = IsSelected;
if (isSelected.HasValue)
WasSelected = isSelected.Value;
adapter.AutomationPropertyChanged
+= new EventHandler<AutomationPropertyChangedEventArgs> (
OnAutomationPropertyChanged);
adapter.AutomationEventRaised
+= new EventHandler<AutomationEventEventArgs> (
OnAutomationEventRaised);
}