Example #1
0
        // Token: 0x06002706 RID: 9990 RVA: 0x000B8AD0 File Offset: 0x000B6CD0
        internal UIElement GetWrapper()
        {
            UIElement result = null;
            ItemsControlAutomationPeer itemsControlAutomationPeer = this.ItemsControlAutomationPeer;

            if (itemsControlAutomationPeer != null)
            {
                ItemsControl itemsControl = (ItemsControl)itemsControlAutomationPeer.Owner;
                if (itemsControl != null)
                {
                    object rawItem = this.RawItem;
                    if (rawItem != DependencyProperty.UnsetValue)
                    {
                        if (((IGeneratorHost)itemsControl).IsItemItsOwnContainer(rawItem))
                        {
                            result = (rawItem as UIElement);
                        }
                        else
                        {
                            result = (itemsControl.ItemContainerGenerator.ContainerFromItem(rawItem) as UIElement);
                        }
                    }
                }
            }
            return(result);
        }
Example #2
0
        // Token: 0x0600287D RID: 10365 RVA: 0x000BC834 File Offset: 0x000BAA34
        private void RecursiveScrollIntoView()
        {
            ItemsControlAutomationPeer itemsControlAutomationPeer = base.ItemsControlAutomationPeer;

            if (this.ParentDataItemAutomationPeer != null && itemsControlAutomationPeer == null)
            {
                this.ParentDataItemAutomationPeer.RecursiveScrollIntoView();
                itemsControlAutomationPeer = base.ItemsControlAutomationPeer;
            }
            if (itemsControlAutomationPeer != null)
            {
                TreeViewItemAutomationPeer treeViewItemAutomationPeer = itemsControlAutomationPeer as TreeViewItemAutomationPeer;
                if (treeViewItemAutomationPeer != null && ((IExpandCollapseProvider)treeViewItemAutomationPeer).ExpandCollapseState == ExpandCollapseState.Collapsed)
                {
                    ((IExpandCollapseProvider)treeViewItemAutomationPeer).Expand();
                }
                ItemsControl itemsControl = itemsControlAutomationPeer.Owner as ItemsControl;
                if (itemsControl != null)
                {
                    if (itemsControl.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated)
                    {
                        itemsControl.OnBringItemIntoView(base.Item);
                        return;
                    }
                    base.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new DispatcherOperationCallback(itemsControl.OnBringItemIntoView), base.Item);
                }
            }
        }
Example #3
0
        // Token: 0x06002730 RID: 10032 RVA: 0x000B92BC File Offset: 0x000B74BC
        internal virtual void RealizeCore()
        {
            ItemsControlAutomationPeer itemsControlAutomationPeer = this.ItemsControlAutomationPeer;

            if (itemsControlAutomationPeer != null)
            {
                ItemsControl parent = itemsControlAutomationPeer.Owner as ItemsControl;
                if (parent != null)
                {
                    if (parent.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated)
                    {
                        if (AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures && VirtualizingPanel.GetIsVirtualizingWhenGrouping(parent))
                        {
                            itemsControlAutomationPeer.RecentlyRealizedPeers.Add(this);
                        }
                        parent.OnBringItemIntoView(this.Item);
                        return;
                    }
                    base.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new DispatcherOperationCallback(delegate(object arg)
                    {
                        if (AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures && VirtualizingPanel.GetIsVirtualizingWhenGrouping(parent))
                        {
                            itemsControlAutomationPeer.RecentlyRealizedPeers.Add(this);
                        }
                        parent.OnBringItemIntoView(arg);
                        return(null);
                    }), this.Item);
                }
            }
        }
 ///
 public TreeViewDataItemAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer, TreeViewDataItemAutomationPeer parentDataItemAutomationPeer) 
     : base(item, null)
 {
     if(itemsControlAutomationPeer.Owner is TreeView || parentDataItemAutomationPeer == null)
         ItemsControlAutomationPeer = itemsControlAutomationPeer; 
     _parentDataItemAutomationPeer = parentDataItemAutomationPeer;
 } 
        internal UIElement GetWrapper()
        {
            UIElement wrapper = null;
            ItemsControlAutomationPeer itemsControlAutomationPeer = ItemsControlAutomationPeer;

            if (itemsControlAutomationPeer != null)
            {
                ItemsControl owner = (ItemsControl)(itemsControlAutomationPeer.Owner);
                if (owner != null)
                {
                    object item = RawItem;
                    if (item != DependencyProperty.UnsetValue)
                    {
                        if (((MS.Internal.Controls.IGeneratorHost)owner).IsItemItsOwnContainer(item))
                        {
                            wrapper = item as UIElement;
                        }
                        else
                        {
                            wrapper = owner.ItemContainerGenerator.ContainerFromItem(item) as UIElement;
                        }
                    }
                }
            }
            return(wrapper);
        }
        ///
        protected override string GetNameCore()
        {
            AutomationPeer wrapperPeer = GetWrapperPeer();
            string         name        = null;
            object         item        = Item;

            if (wrapperPeer != null)
            {
                name = wrapperPeer.GetName();
            }
            else if (item != null)
            {
                using (RecyclableWrapper recyclableWrapper = ItemsControlAutomationPeer.GetRecyclableWrapperPeer(item))
                {
                    name = recyclableWrapper.Peer.GetName();
                }
            }

            if (string.IsNullOrEmpty(name) && item != null)
            {
                // For FE we can't use ToString as that provides extraneous information than just the plain text
                FrameworkElement fe = item as FrameworkElement;
                if (fe != null)
                {
                    name = fe.GetPlainText();
                }

                if (string.IsNullOrEmpty(name))
                {
                    name = item.ToString();
                }
            }

            return(name);
        }
Example #7
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Automation.Peers.TreeViewDataItemAutomationPeer" /> class. </summary>
 /// <param name="item">The data item in the <see cref="P:System.Windows.Controls.ItemsControl.Items" /> collection that is associated with this <see cref="T:System.Windows.Automation.Peers.TreeViewDataItemAutomationPeer" />.</param>
 /// <param name="itemsControlAutomationPeer">The <see cref="T:System.Windows.Automation.Peers.ItemsControlAutomationPeer" /> that is associated with the <see cref="T:System.Windows.Controls.ItemsControl" /> that holds the <see cref="P:System.Windows.Controls.ItemsControl.Items" /> collection.</param>
 /// <param name="parentDataItemAutomationPeer">The <see cref="T:System.Windows.Automation.Peers.TreeViewDataItemAutomationPeer" /> that is the parent to this <see cref="T:System.Windows.Automation.Peers.TreeViewDataItemAutomationPeer" />.</param>
 // Token: 0x0600286A RID: 10346 RVA: 0x000BC5D0 File Offset: 0x000BA7D0
 public TreeViewDataItemAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer, TreeViewDataItemAutomationPeer parentDataItemAutomationPeer) : base(item, null)
 {
     if (itemsControlAutomationPeer.Owner is TreeView || parentDataItemAutomationPeer == null)
     {
         base.ItemsControlAutomationPeer = itemsControlAutomationPeer;
     }
     this._parentDataItemAutomationPeer = parentDataItemAutomationPeer;
 }
        override internal void AddToParentProxyWeakRefCache()
        {
            ItemsControlAutomationPeer itemsControlAutomationPeer = ItemsControlAutomationPeer;

            if (itemsControlAutomationPeer != null)
            {
                itemsControlAutomationPeer.AddProxyToWeakRefStorage(this.ElementProxyWeakReference, this);
            }
        }
        // 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);
        }
        virtual internal void RealizeCore()
        {
            ItemsControlAutomationPeer itemsControlAutomationPeer = ItemsControlAutomationPeer;

            if (itemsControlAutomationPeer != null)
            {
                ItemsControl parent = itemsControlAutomationPeer.Owner as ItemsControl;
                if (parent != null)
                {
                    if (parent.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated)
                    {
                        if (AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures)
                        {
                            // Please note that this action must happen before the OnBringItemIntoView call because
                            // that is a call that synchronously flushes out layout and we want these realized peers
                            // cached before the UpdateSubtree kicks in OnLayoutUpdated.
                            if (VirtualizingPanel.GetIsVirtualizingWhenGrouping(parent))
                            {
                                itemsControlAutomationPeer.RecentlyRealizedPeers.Add(this);
                            }
                        }

                        parent.OnBringItemIntoView(Item);
                    }
                    else
                    {
                        // The items aren't generated, try at a later time
                        Dispatcher.BeginInvoke(DispatcherPriority.Loaded,
                                               (DispatcherOperationCallback) delegate(object arg)
                        {
                            if (AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures)
                            {
                                // Please note that this action must happen before the OnBringItemIntoView call because
                                // that is a call that synchronously flushes out layout and we want these realized peers
                                // cached before the UpdateSubtree kicks in OnLayoutUpdated.
                                if (VirtualizingPanel.GetIsVirtualizingWhenGrouping(parent))
                                {
                                    itemsControlAutomationPeer.RecentlyRealizedPeers.Add(this);
                                }
                            }

                            parent.OnBringItemIntoView(arg);

                            return(null);
                        }, Item);
                    }
                }
            }
        }
Example #11
0
        private UIElement GetWrapper()
        {
            UIElement result = null;
            ItemsControlAutomationPeer itemsControlAutomationPeer = ItemsControlAutomationPeer;

            if (itemsControlAutomationPeer != null)
            {
                ItemsControl itemsControl = (ItemsControl)itemsControlAutomationPeer.Owner;
                if (itemsControl != null)
                {
                    result = itemsControl.ItemContainerGenerator.ContainerFromItem(Item) as UIElement;
                }
            }

            return(result);
        }
 internal static new bool IsPropertySupportedByControlForFindItemInternal(int id)
 {
     if (ItemsControlAutomationPeer.IsPropertySupportedByControlForFindItemInternal(id))
     {
         return(true);
     }
     else
     {
         if (SelectionItemPatternIdentifiers.IsSelectedProperty.Id == id)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #13
0
        ///
        protected override string GetAutomationIdCore()
        {
            AutomationPeer wrapperPeer = GetWrapperPeer();
            string         id          = null;

            if (wrapperPeer != null)
            {
                id = wrapperPeer.GetAutomationId();
            }
            else if (_item != null)
            {
                using (RecyclableWrapper recyclableWrapper = ItemsControlAutomationPeer.GetRecyclableWrapperPeer(_item))
                {
                    id = recyclableWrapper.Peer.GetAutomationId();
                }
            }

            return(id);
        }
Example #14
0
        internal UIElement GetWrapper()
        {
            UIElement wrapper = null;
            ItemsControlAutomationPeer itemsControlAutomationPeer = ItemsControlAutomationPeer;

            if (itemsControlAutomationPeer != null)
            {
                ItemsControl owner = (ItemsControl)(itemsControlAutomationPeer.Owner);
                if (owner != null)
                {
                    if (((MS.Internal.Controls.IGeneratorHost)owner).IsItemItsOwnContainer(_item))
                    {
                        wrapper = _item as UIElement;
                    }
                    else
                    {
                        wrapper = owner.ItemContainerGenerator.ContainerFromItem(_item) as UIElement;
                    }
                }
            }
            return(wrapper);
        }
        private void RecursiveScrollIntoView()
        {
            ItemsControlAutomationPeer itemsControlAutomationPeer = ItemsControlAutomationPeer;

            // to check if the parent of this item is TreeViewItem.
            if (ParentDataItemAutomationPeer != null)
            {
                // there might be a possibility that it's parent item is itself virtualized so we have to realize it and make a second attempt
                if (itemsControlAutomationPeer == null)
                {
                    ParentDataItemAutomationPeer.RecursiveScrollIntoView();
                    itemsControlAutomationPeer = ItemsControlAutomationPeer;
                }
            }

            if (itemsControlAutomationPeer != null)
            {
                TreeViewItemAutomationPeer treeViewItemAutomationPeer = itemsControlAutomationPeer as TreeViewItemAutomationPeer;
                if (treeViewItemAutomationPeer != null && (treeViewItemAutomationPeer as IExpandCollapseProvider).ExpandCollapseState == ExpandCollapseState.Collapsed)
                {
                    (treeViewItemAutomationPeer as IExpandCollapseProvider).Expand();
                }

                ItemsControl parent = itemsControlAutomationPeer.Owner as ItemsControl;
                if (parent != null)
                {
                    if (parent.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated)
                    {
                        parent.OnBringItemIntoView(Item);
                    }
                    else
                    {
                        // The items aren't generated, try at a later time
                        Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new DispatcherOperationCallback(parent.OnBringItemIntoView), Item);
                    }
                }
            }
        }
 protected ItemAutomationPeer(Object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
 {
 }
        ///
        protected override List <AutomationPeer> GetChildrenCore()
        {
            GroupItem    owner        = (GroupItem)Owner;
            ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(Owner);

            if (itemsControl != null)
            {
                ItemsControlAutomationPeer itemsControlAP = itemsControl.CreateAutomationPeer() as ItemsControlAutomationPeer;
                if (itemsControlAP != null)
                {
                    Panel itemsHost = owner.ItemsHost;

                    if (itemsHost == null)
                    {
                        return(null);
                    }

                    IList childItems = itemsHost.Children;
                    List <AutomationPeer> children = new List <AutomationPeer>(childItems.Count);

                    foreach (UIElement child in childItems)
                    {
                        if (!((MS.Internal.Controls.IGeneratorHost)itemsControl).IsItemItsOwnContainer(child))
                        {
                            UIElementAutomationPeer peer = child.CreateAutomationPeer() as UIElementAutomationPeer;
                            if (peer != null)
                            {
                                children.Add(peer);

                                //
                                // The AncestorsInvalid check is meant so that we do this call to invalidate the
                                // GroupItemPeers containing the realized item peers only when we arrive here from an
                                // UpdateSubtree call because that call does not otherwise descend into parts of the tree
                                // that have their children invalid as an optimization.
                                //
                                if (itemsControlAP.RecentlyRealizedPeers.Count > 0 && this.AncestorsInvalid)
                                {
                                    GroupItemAutomationPeer groupItemPeer = peer as GroupItemAutomationPeer;
                                    if (groupItemPeer != null)
                                    {
                                        groupItemPeer.InvalidateGroupItemPeersContainingRecentlyRealizedPeers(itemsControlAP.RecentlyRealizedPeers);
                                    }
                                }
                            }
                        }
                        else
                        {
                            object item = itemsControl.GetItemOrContainerFromContainer(child);

                            // try to reuse old peer if it exists either in Current AT or in WeakRefStorage of Peers being sent to Client
                            ItemAutomationPeer peer = itemsControlAP.ItemPeers[item];
                            if (peer == null)
                            {
                                peer = itemsControlAP.GetPeerFromWeakRefStorage(item);

                                if (peer != null)
                                {
                                    // As cached peer is getting used it must be invalidated.
                                    peer.AncestorsInvalid = false;
                                    peer.ChildrenValid    = false;
                                }
                            }

                            if (peer != null)
                            {
                                //
                                // We have now connected the realized peer to its actual parent. Hence the cache can be cleared
                                //
                                int realizedPeerIndex = itemsControlAP.RecentlyRealizedPeers.IndexOf(peer);
                                if (realizedPeerIndex >= 0)
                                {
                                    itemsControlAP.RecentlyRealizedPeers.RemoveAt(realizedPeerIndex);
                                }
                            }
                            else
                            {
                                peer = itemsControlAP.CreateItemAutomationPeerInternal(item);
                            }

                            //perform hookup so the events sourced from wrapper peer are fired as if from the data item
                            if (peer != null)
                            {
                                AutomationPeer wrapperPeer = peer.GetWrapperPeer();
                                if (wrapperPeer != null)
                                {
                                    wrapperPeer.EventsSource = peer;
                                    if (peer.ChildrenValid && peer.Children == null && this.AncestorsInvalid)
                                    {
                                        peer.AncestorsInvalid        = true;
                                        wrapperPeer.AncestorsInvalid = true;
                                    }
                                }
                            }

                            //protection from indistinguishable items - for example, 2 strings with same value
                            //this scenario does not work in ItemsControl however is not checked for.
                            if (itemsControlAP.ItemPeers[item] == null)
                            {
                                children.Add(peer);
                                itemsControlAP.ItemPeers[item] = peer;
                            }
                        }
                    }

                    return(children);
                }
            }

            return(null);
        }
Example #18
0
 /// <summary>Provides initialization for base class values when called by the constructor of a derived class.</summary>
 /// <param name="item">The data item in the <see cref="P:System.Windows.Controls.ItemsControl.Items" /> collection that is associated with this <see cref="T:System.Windows.Automation.Peers.ItemAutomationPeer" />.</param>
 /// <param name="itemsControlAutomationPeer">The <see cref="T:System.Windows.Automation.Peers.ItemsControlAutomationPeer" /> that is associated with the <see cref="T:System.Windows.Controls.ItemsControl" /> that holds the <see cref="P:System.Windows.Controls.ItemsControl.Items" /> collection.</param>
 // Token: 0x06002702 RID: 9986 RVA: 0x000B8A2E File Offset: 0x000B6C2E
 protected ItemAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
 {
     this.Item = item;
     this._itemsControlAutomationPeer = itemsControlAutomationPeer;
 }
 /// <summary>
 /// Initialises a new instance of the <see cref="AccordionItemAutomationPeer"/> class.
 /// </summary>
 /// <param name="item">The item associated with this AutomationPeer</param>
 /// <param name="itemsControlAutomationPeer">The Accordion that is associated with this item.</param>
 public AccordionItemAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
     : base(item, itemsControlAutomationPeer)
 {
 }
        ///
        protected override List <AutomationPeer> GetChildrenCore()
        {
            GroupItem    owner        = (GroupItem)Owner;
            ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(Owner);

            if (itemsControl != null)
            {
                ItemsControlAutomationPeer itemsControlAP = itemsControl.CreateAutomationPeer() as ItemsControlAutomationPeer;
                if (itemsControlAP != null)
                {
                    List <AutomationPeer> children = new List <AutomationPeer>();
                    bool useNetFx472CompatibleAccessibilityFeatures = AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures;

                    if (!useNetFx472CompatibleAccessibilityFeatures && owner.Expander != null)
                    {
                        _expanderPeer = UIElementAutomationPeer.CreatePeerForElement(owner.Expander);

                        if (_expanderPeer != null)
                        {
                            _expanderPeer.EventsSource = this;

                            // Call GetChildren so the Expander's toggle button updates its EventsSource as well
                            _expanderPeer.GetChildren();
                        }
                    }
                    Panel itemsHost = owner.ItemsHost;

                    if (itemsHost == null)
                    {
                        if (_expanderPeer == null)
                        {
                            return(null);
                        }
                        else
                        {
                            children.Add(_expanderPeer);
                            return(children);
                        }
                    }

                    IList childItems = itemsHost.Children;
                    ItemPeersStorage <ItemAutomationPeer> addedChildren = new ItemPeersStorage <ItemAutomationPeer>();


                    foreach (UIElement child in childItems)
                    {
                        if (!((MS.Internal.Controls.IGeneratorHost)itemsControl).IsItemItsOwnContainer(child))
                        {
                            UIElementAutomationPeer peer = child.CreateAutomationPeer() as UIElementAutomationPeer;
                            if (peer != null)
                            {
                                children.Add(peer);

                                if (useNetFx472CompatibleAccessibilityFeatures)
                                {
                                    //
                                    // The AncestorsInvalid check is meant so that we do this call to invalidate the
                                    // GroupItemPeers containing the realized item peers only when we arrive here from an
                                    // UpdateSubtree call because that call does not otherwise descend into parts of the tree
                                    // that have their children invalid as an optimization.
                                    //
                                    if (itemsControlAP.RecentlyRealizedPeers.Count > 0 && this.AncestorsInvalid)
                                    {
                                        GroupItemAutomationPeer groupItemPeer = peer as GroupItemAutomationPeer;
                                        if (groupItemPeer != null)
                                        {
                                            groupItemPeer.InvalidateGroupItemPeersContainingRecentlyRealizedPeers(itemsControlAP.RecentlyRealizedPeers);
                                        }
                                    }
                                }
                                else
                                {
                                    //
                                    // The AncestorsInvalid check is meant so that we do this call to invalidate the
                                    // GroupItemPeers only when we arrive here from an
                                    // UpdateSubtree call because that call does not otherwise descend into parts of the tree
                                    // that have their children invalid as an optimization.
                                    //
                                    if (this.AncestorsInvalid)
                                    {
                                        GroupItemAutomationPeer groupItemPeer = peer as GroupItemAutomationPeer;
                                        if (groupItemPeer != null)
                                        {
                                            // invalidate all GroupItemAP children, so
                                            // that the top-level ItemsControlAP's
                                            // ItemPeers collection is repopulated.
                                            groupItemPeer.AncestorsInvalid = true;
                                            groupItemPeer.ChildrenValid    = true;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            object item = itemsControl.ItemContainerGenerator.ItemFromContainer(child);

                            // ItemFromContainer can return {UnsetValue} if we're in a re-entrant
                            // call while the generator is in the midst of unhooking the container.
                            // Ignore such children.
                            if (item == DependencyProperty.UnsetValue)
                            {
                                continue;
                            }

                            // try to reuse old peer if it exists either in Current AT or in WeakRefStorage of Peers being sent to Client
                            ItemAutomationPeer peer = useNetFx472CompatibleAccessibilityFeatures
                                                        ? itemsControlAP.ItemPeers[item]
                                                        : itemsControlAP.ReusablePeerFor(item);

                            peer = itemsControlAP.ReusePeerForItem(peer, item);

                            if (peer != null)
                            {
                                if (useNetFx472CompatibleAccessibilityFeatures)
                                {
                                    //
                                    // We have now connected the realized peer to its actual parent. Hence the cache can be cleared
                                    //
                                    int realizedPeerIndex = itemsControlAP.RecentlyRealizedPeers.IndexOf(peer);
                                    if (realizedPeerIndex >= 0)
                                    {
                                        itemsControlAP.RecentlyRealizedPeers.RemoveAt(realizedPeerIndex);
                                    }
                                }
                            }
                            else
                            {
                                peer = itemsControlAP.CreateItemAutomationPeerInternal(item);
                            }

                            //perform hookup so the events sourced from wrapper peer are fired as if from the data item
                            if (peer != null)
                            {
                                AutomationPeer wrapperPeer = peer.GetWrapperPeer();
                                if (wrapperPeer != null)
                                {
                                    wrapperPeer.EventsSource = peer;
                                    if (peer.ChildrenValid && peer.Children == null && this.AncestorsInvalid)
                                    {
                                        peer.AncestorsInvalid        = true;
                                        wrapperPeer.AncestorsInvalid = true;
                                    }
                                }
                            }

                            //protection from indistinguishable items - for example, 2 strings with same value
                            //this scenario does not work in ItemsControl however is not checked for.
                            //  Our parent's ItemPeerStorage collection may not have been cleared,
                            // this would cause us to report 0 children, if the peer is already in the collection
                            // check its parent, if it has been set to us, we should add it to the return collection,
                            // but only if we haven't added a peer for this item during this GetChildrenCore call.
                            bool itemMissingPeerInGlobalStorage = itemsControlAP.ItemPeers[item] == null;

                            if (peer != null && (itemMissingPeerInGlobalStorage ||
                                                 (peer.GetParent() == this && addedChildren[item] == null)))
                            {
                                children.Add(peer);
                                addedChildren[item] = peer;

                                if (itemMissingPeerInGlobalStorage)
                                {
                                    itemsControlAP.ItemPeers[item] = peer;
                                }
                            }
                        }
                    }

                    return(children);
                }
            }

            return(null);
        }
Example #21
0
 /// <summary>
 /// Exposes a <see cref="Views.Row"/> object to UI automation.
 /// </summary>
 /// <param name="item">The data item in the <see cref="P:System.Windows.Controls.ItemsControl.Items"/> collection that is associated with this <see cref="T:System.Windows.Automation.Peers.ItemAutomationPeer"/>.</param>
 /// <param name="itemsControlAutomationPeer">The <see cref="T:System.Windows.Automation.Peers.ItemsControlAutomationPeer"/> that is associated with the <see cref="T:System.Windows.Controls.ItemsControl"/> that holds the <see cref="P:System.Windows.Controls.ItemsControl.Items"/> collection.</param>
 public RowAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
     : base(item, itemsControlAutomationPeer)
 {
 }
Example #22
0
 ///
 protected ItemAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer): base() 
 {
     _item = item;
     _itemsControlAutomationPeer = itemsControlAutomationPeer;
 } 
 ///
 public RibbonGalleryCategoryDataAutomationPeer(object owner, ItemsControlAutomationPeer itemsControlAutomationPeer)
     : base(owner, itemsControlAutomationPeer)
 {
 }
 public RibbonMenuItemDataAutomationPeer(object item, ItemsControlAutomationPeer itemsControlPeer)
     : base(item, itemsControlPeer)
 {
 }
 internal UpdateChildrenHelper(ItemsControlAutomationPeer peer)
 {
     _peer        = peer;
     _oldChildren = peer.ItemPeers;
 }
 protected ItemAutomationPeer(Object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
 {
 }
 ///
 protected ItemAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer) : base()
 {
     Item = item;
     _itemsControlAutomationPeer = itemsControlAutomationPeer;
 }
 public MultiSelectTreeViewItemDataAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
     : base(item, itemsControlAutomationPeer)
 {
 }
 // Token: 0x060027EB RID: 10219 RVA: 0x000BB196 File Offset: 0x000B9396
 internal new static bool IsPropertySupportedByControlForFindItemInternal(int id)
 {
     return(ItemsControlAutomationPeer.IsPropertySupportedByControlForFindItemInternal(id) || SelectionItemPatternIdentifiers.IsSelectedProperty.Id == id);
 }
        /// <summary>Gets the collection of child elements of the <see cref="T:System.Windows.Controls.GroupItem" /> that is associated with this <see cref="T:System.Windows.Automation.Peers.GroupItemAutomationPeer" />. This method is called by <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetChildren" />.</summary>
        /// <returns>The collection of child elements.</returns>
        // Token: 0x060026E9 RID: 9961 RVA: 0x000B8530 File Offset: 0x000B6730
        protected override List <AutomationPeer> GetChildrenCore()
        {
            GroupItem    groupItem    = (GroupItem)base.Owner;
            ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(base.Owner);

            if (itemsControl != null)
            {
                ItemsControlAutomationPeer itemsControlAutomationPeer = itemsControl.CreateAutomationPeer() as ItemsControlAutomationPeer;
                if (itemsControlAutomationPeer != null)
                {
                    Panel itemsHost = groupItem.ItemsHost;
                    if (itemsHost == null)
                    {
                        return(null);
                    }
                    IList children             = itemsHost.Children;
                    List <AutomationPeer> list = new List <AutomationPeer>(children.Count);
                    ItemPeersStorage <ItemAutomationPeer> itemPeersStorage = new ItemPeersStorage <ItemAutomationPeer>();
                    bool useNetFx472CompatibleAccessibilityFeatures        = AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures;
                    if (!useNetFx472CompatibleAccessibilityFeatures && groupItem.Expander != null)
                    {
                        this._expanderPeer = UIElementAutomationPeer.CreatePeerForElement(groupItem.Expander);
                        if (this._expanderPeer != null)
                        {
                            this._expanderPeer.EventsSource = this;
                            this._expanderPeer.GetChildren();
                        }
                    }
                    foreach (object obj in children)
                    {
                        UIElement uielement = (UIElement)obj;
                        if (!((IGeneratorHost)itemsControl).IsItemItsOwnContainer(uielement))
                        {
                            UIElementAutomationPeer uielementAutomationPeer = uielement.CreateAutomationPeer() as UIElementAutomationPeer;
                            if (uielementAutomationPeer != null)
                            {
                                list.Add(uielementAutomationPeer);
                                if (useNetFx472CompatibleAccessibilityFeatures)
                                {
                                    if (itemsControlAutomationPeer.RecentlyRealizedPeers.Count > 0 && this.AncestorsInvalid)
                                    {
                                        GroupItemAutomationPeer groupItemAutomationPeer = uielementAutomationPeer as GroupItemAutomationPeer;
                                        if (groupItemAutomationPeer != null)
                                        {
                                            groupItemAutomationPeer.InvalidateGroupItemPeersContainingRecentlyRealizedPeers(itemsControlAutomationPeer.RecentlyRealizedPeers);
                                        }
                                    }
                                }
                                else if (this.AncestorsInvalid)
                                {
                                    GroupItemAutomationPeer groupItemAutomationPeer2 = uielementAutomationPeer as GroupItemAutomationPeer;
                                    if (groupItemAutomationPeer2 != null)
                                    {
                                        groupItemAutomationPeer2.AncestorsInvalid = true;
                                        groupItemAutomationPeer2.ChildrenValid    = true;
                                    }
                                }
                            }
                        }
                        else
                        {
                            object obj2 = itemsControl.ItemContainerGenerator.ItemFromContainer(uielement);
                            if (obj2 != DependencyProperty.UnsetValue)
                            {
                                ItemAutomationPeer itemAutomationPeer = useNetFx472CompatibleAccessibilityFeatures ? itemsControlAutomationPeer.ItemPeers[obj2] : itemsControlAutomationPeer.ReusablePeerFor(obj2);
                                itemAutomationPeer = itemsControlAutomationPeer.ReusePeerForItem(itemAutomationPeer, obj2);
                                if (itemAutomationPeer != null)
                                {
                                    if (useNetFx472CompatibleAccessibilityFeatures)
                                    {
                                        int num = itemsControlAutomationPeer.RecentlyRealizedPeers.IndexOf(itemAutomationPeer);
                                        if (num >= 0)
                                        {
                                            itemsControlAutomationPeer.RecentlyRealizedPeers.RemoveAt(num);
                                        }
                                    }
                                }
                                else
                                {
                                    itemAutomationPeer = itemsControlAutomationPeer.CreateItemAutomationPeerInternal(obj2);
                                }
                                if (itemAutomationPeer != null)
                                {
                                    AutomationPeer wrapperPeer = itemAutomationPeer.GetWrapperPeer();
                                    if (wrapperPeer != null)
                                    {
                                        wrapperPeer.EventsSource = itemAutomationPeer;
                                        if (itemAutomationPeer.ChildrenValid && itemAutomationPeer.Children == null && this.AncestorsInvalid)
                                        {
                                            itemAutomationPeer.AncestorsInvalid = true;
                                            wrapperPeer.AncestorsInvalid        = true;
                                        }
                                    }
                                }
                                bool flag = itemsControlAutomationPeer.ItemPeers[obj2] == null;
                                if (itemAutomationPeer != null && (flag || (itemAutomationPeer.GetParent() == this && itemPeersStorage[obj2] == null)))
                                {
                                    list.Add(itemAutomationPeer);
                                    itemPeersStorage[obj2] = itemAutomationPeer;
                                    if (flag)
                                    {
                                        itemsControlAutomationPeer.ItemPeers[obj2] = itemAutomationPeer;
                                    }
                                }
                            }
                        }
                    }
                    return(list);
                }
            }
            return(null);
        }
		public MultiSelectTreeViewItemDataAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
			: base(item, itemsControlAutomationPeer)
		{
		}
Example #32
0
 protected ItemAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer) : base(null)
 {
     throw new NotImplementedException();
 }
 ///
 public RibbonGalleryItemDataAutomationPeer(object owner, ItemsControlAutomationPeer itemsControlAutomationPeer, RibbonGalleryCategoryDataAutomationPeer parentCategoryDataAutomationPeer)
     : base(owner, itemsControlAutomationPeer)
 {
     _parentCategoryDataAutomationPeer = parentCategoryDataAutomationPeer;
 }
Example #34
0
 public TreeViewExItemDataAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
     : base(item, itemsControlAutomationPeer)
 {
 }
 /// <summary>
 /// Exposes a <see cref="Views.HeaderCell"/> object to UI automation.
 /// </summary>
 /// <param name="item">The data item in the <see cref="P:System.Windows.Controls.ItemsControl.Items"/> collection that is associated with this <see cref="T:System.Windows.Automation.Peers.ItemAutomationPeer"/>.</param>
 /// <param name="itemsControlAutomationPeer">The <see cref="T:System.Windows.Automation.Peers.ItemsControlAutomationPeer"/> that is associated with the <see cref="T:System.Windows.Controls.ItemsControl"/> that holds the <see cref="P:System.Windows.Controls.ItemsControl.Items"/> collection.</param>
 public HeaderCellAutomationPeer(object item, ItemsControlAutomationPeer itemsControlAutomationPeer)
     : base(item, itemsControlAutomationPeer)
 {
 }
Example #36
0
 /// <summary>
 /// Verifies whether the propertyId is supported by find criterion. It can be overriden by derived classes
 /// if they wish to support more properties.
 /// </summary>
 /// <param name="id">Property Id to be verified</param>
 /// <returns>true if property id is supported else false</returns>
 virtual internal bool IsPropertySupportedByControlForFindItem(int id)
 {
     return(ItemsControlAutomationPeer.IsPropertySupportedByControlForFindItemInternal(id));
 }
 public TreeViewDataItemAutomationPeer(Object item, ItemsControlAutomationPeer itemsControlAutomationPeer, TreeViewDataItemAutomationPeer parentDataItemAutomationPeer) : base (default(Object), default(ItemsControlAutomationPeer))
 {
   Contract.Requires(itemsControlAutomationPeer != null);
 }
Example #38
0
 /// <summary>
 /// This method is responsible for providing the value corresponding to the propertyId for itemPeer
 /// This method can be overriden by derived classes if they support more properties for search.
 /// </summary>
 /// <param name="itemPeer"></param>
 /// <param name="propertyId"></param>
 /// <returns>returns the property value</returns>
 virtual internal object GetSupportedPropertyValue(ItemAutomationPeer itemPeer, int propertyId)
 {
     return(ItemsControlAutomationPeer.GetSupportedPropertyValueInternal(itemPeer, propertyId));
 }
Example #39
0
		protected ItemAutomationPeer (object item, ItemsControlAutomationPeer itemsControlAutomationPeer) : base (null)
		{
			throw new NotImplementedException ();
		}
Example #40
0
 public TreeViewDataItemAutomationPeer(Object item, ItemsControlAutomationPeer itemsControlAutomationPeer, TreeViewDataItemAutomationPeer parentDataItemAutomationPeer) : base(default(Object), default(ItemsControlAutomationPeer))
 {
     Contract.Requires(itemsControlAutomationPeer != null);
 }