Exemple #1
0
        /// <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;

            Controls.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);
        }
Exemple #2
0
        protected override List <AutomationPeer> GetChildrenCore()
        {
            List <AutomationPeer> children = new List <AutomationPeer>();

            Controls.AutoCompleteBox owner = OwnerAutoCompleteBox;

            // TextBox part.
            TextBox textBox = owner.TextBox;

            if (textBox != null)
            {
                AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(textBox);
                if (peer != null)
                {
                    children.Insert(0, peer);
                }
            }

            // Include SelectionAdapter's children.
            if (owner.SelectionAdapter != null)
            {
                AutomationPeer selectionAdapterPeer = owner.SelectionAdapter.CreateAutomationPeer();
                if (selectionAdapterPeer != null)
                {
                    List <AutomationPeer> listChildren = selectionAdapterPeer.GetChildren();
                    if (listChildren != null)
                    {
                        foreach (AutomationPeer child in listChildren)
                        {
                            children.Add(child);
                        }
                    }
                }
            }

            return(children);
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the AutoCompleteBoxAutomationPeer
 /// class.
 /// </summary>
 /// <param name="owner">
 /// The AutoCompleteBox that is associated with this
 /// AutoCompleteBoxAutomationPeer.
 /// </param>
 public AutoCompleteBoxAutomationPeer(Controls.AutoCompleteBox owner)
     : base(owner)
 {
 }