/// <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); }
/// override public object GetPattern(PatternInterface patternInterface) { object returnValue = null; RichTextBox owner = (RichTextBox)Owner; if (patternInterface == PatternInterface.Text) { if (_textPattern == null) { _textPattern = new TextAdaptor(this, owner.TextContainer); } return(_textPattern); } else { if (patternInterface == PatternInterface.Scroll) { 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); }
/// <summary> /// Constructor. /// </summary> /// <param name="owner">Owner of the AutomationPeer.</param> public DocumentAutomationPeer(FrameworkContentElement owner) : base(owner) { if (owner is IServiceProvider) { _textContainer = ((IServiceProvider)owner).GetService(typeof(ITextContainer)) as ITextContainer; if (_textContainer != null) { _textPattern = new TextAdaptor(this, _textContainer); } } }
/// public RichTextBoxAutomationPeer(RichTextBox owner) : base(owner) { _textPattern = new TextAdaptor(this, owner.TextContainer); }
/// <summary> /// Convert TextPointers to ITextRangeProvider /// </summary> private ITextRangeProvider TextRangeFromTextPointers(TextPointer rangeStart, TextPointer rangeEnd) { TextAdaptor textAdaptor = GetPattern(PatternInterface.Text) as TextAdaptor; return(textAdaptor?.TextRangeFromTextPointers(rangeStart, rangeEnd)); }
/// public TextBoxAutomationPeer(TextBox owner) : base(owner) { _textPattern = new TextAdaptor(this, ((TextBoxBase)owner).TextContainer); }