/// <summary> 
        /// Return the patterns supported by PasswordBoxAutomationPeer
        /// </summary> 
        /// <param name="patternInterface"></param> 
        /// <returns></returns>
        override public object GetPattern(PatternInterface patternInterface) 
        {
            object returnValue = null;

            if (patternInterface == PatternInterface.Value) 
            {
                returnValue = this; 
            } 
            else if (patternInterface == PatternInterface.Text)
            { 
                if (_textPattern == null)
                {
                    _textPattern = new TextAdaptor(this, ((PasswordBox)Owner).TextContainer);
                } 

                returnValue = _textPattern; 
            } 
            else if (patternInterface == PatternInterface.Scroll)
            { 
                PasswordBox owner = (PasswordBox)Owner;
                if (owner.ScrollViewer != null)
                {
                    returnValue = owner.ScrollViewer.CreateAutomationPeer(); 
                    ((AutomationPeer)returnValue).EventsSource = this;
                } 
            } 
            else
            { 
                returnValue = base.GetPattern(patternInterface);
            }

            return returnValue; 
        }
        /// 
        override public object GetPattern(PatternInterface patternInterface)
        {
            object returnValue = null;

            if(patternInterface == PatternInterface.Value)
                returnValue = this;

            if (patternInterface == PatternInterface.Text)
            {
                if(_textPattern == null)
                    _textPattern = new TextAdaptor(this, ((TextBoxBase)Owner).TextContainer);

                return _textPattern;
            }

            if (patternInterface == PatternInterface.Scroll)
            {
                TextBox owner = (TextBox)Owner;
                if (owner.ScrollViewer != null)
                {
                    returnValue = owner.ScrollViewer.CreateAutomationPeer();
                    ((AutomationPeer)returnValue).EventsSource = this;
                }
            }

            if (patternInterface == PatternInterface.SynchronizedInput)
            {
                returnValue = base.GetPattern(patternInterface);
            }
            return returnValue;
        }
示例#3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="owner">Owner of the AutomationPeer.</param>
 public DocumentAutomationPeer(FrameworkContentElement owner)
     : base(owner)
 {
     if (owner is IServiceProvider)
     {
         ITextContainer textContainer = ((IServiceProvider)owner).GetService(typeof(ITextContainer)) as ITextContainer;
         if (textContainer != null)
         {
             _textPattern = new TextAdaptor(this, textContainer);
         }
     }
 }
 ///
 public TextBoxAutomationPeer(TextBox owner): base(owner)
 {
     _textPattern = new TextAdaptor(this, ((TextBoxBase)owner).TextContainer);
 }
示例#5
0
        /// <summary>
        /// Constructor
        /// </summary>
        internal TextRangeAdaptor(TextAdaptor textAdaptor, ITextPointer start, ITextPointer end, AutomationPeer textPeer)
        {
            Invariant.Assert(textAdaptor != null, "Invalid textAdaptor.");
            Invariant.Assert(textPeer != null, "Invalid textPeer.");
            Invariant.Assert(start != null && end != null, "Invalid range.");
            Invariant.Assert(start.CompareTo(end) <= 0, "Invalid range, end < start.");

            _textAdaptor = textAdaptor;
            _start = start.CreatePointer();
            _end = end.CreatePointer();
            _textPeer = textPeer;
        }
 /// 
 public RichTextBoxAutomationPeer(RichTextBox owner): base(owner)
 { 
     _textPattern = new TextAdaptor(this, owner.TextContainer); 
 }
示例#7
0
        /// <summary>
        /// <see cref="AutomationPeer.GetAutomationControlTypeCore"/>
        /// </summary>
        public override object GetPattern(PatternInterface patternInterface)
        {
            object returnValue = null;

            if (patternInterface == PatternInterface.Text)
            {
                if (_textPattern == null)
                {
                    if (Owner is IServiceProvider)
                    {
                        ITextContainer textContainer = ((IServiceProvider)Owner).GetService(typeof(ITextContainer)) as ITextContainer;
                        if (textContainer != null)
                        {
                            _textPattern = new TextAdaptor(this, textContainer);
                        }
                    }
                }
                returnValue = _textPattern;
            }
            else
            {
                returnValue = base.GetPattern(patternInterface);
            }
            return returnValue;
        }