Exemple #1
0
 /// <summary>Returns the object that supports the specified control pattern of the element that is associated with this automation peer.</summary>
 /// <param name="patternInterface">An enumeration value that specifies the control pattern.</param>
 /// <returns>An object that supports the control pattern if <paramref name="patternInterface" /> is a supported value; otherwise, <see langword="null" />. </returns>
 // Token: 0x06002705 RID: 9989 RVA: 0x000B8A70 File Offset: 0x000B6C70
 public override object GetPattern(PatternInterface patternInterface)
 {
     if (patternInterface == PatternInterface.VirtualizedItem)
     {
         if (VirtualizedItemPatternIdentifiers.Pattern != null)
         {
             if (this.GetWrapperPeer() == null)
             {
                 return(this);
             }
             if (this.ItemsControlAutomationPeer != null && !this.IsItemInAutomationTree())
             {
                 return(this);
             }
             if (this.ItemsControlAutomationPeer == null)
             {
                 return(this);
             }
         }
         return(null);
     }
     if (patternInterface == PatternInterface.SynchronizedInput)
     {
         UIElementAutomationPeer uielementAutomationPeer = this.GetWrapperPeer() as UIElementAutomationPeer;
         if (uielementAutomationPeer != null)
         {
             return(uielementAutomationPeer.GetPattern(patternInterface));
         }
     }
     return(null);
 }
        ///
        override public object GetPattern(PatternInterface patternInterface)
        {
            if (patternInterface == PatternInterface.VirtualizedItem)
            {
                if (VirtualizedItemPatternIdentifiers.Pattern != null)
                {
                    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);
        }