Example #1
0
 private void ClearContentElement()
 {
     if (_textViewHost != null)
     {
         _textViewHost.DetachView();
         _textViewHost = null;
     }
 }
Example #2
0
        private void InitializeContentElement()
        {
            _textViewHost = GetContentHost(_contentElement);

            if (_textViewHost != null)
            {
                TextBoxView view = CreateView();
                _textViewHost.AttachView(view);
            }
        }
Example #3
0
 // Constructor.
 internal TextBoxView(ITextBoxViewHost host)
 {
     Invariant.Assert(host is Control);
     _host = host;
 }
        // Token: 0x06004135 RID: 16693 RVA: 0x0012A278 File Offset: 0x00128478
        internal TextBoxLineDrawingVisual CreateVisual(Geometry selectionGeometry)
        {
            TextBoxLineDrawingVisual textBoxLineDrawingVisual = new TextBoxLineDrawingVisual();
            double         x = this.CalculateXOffsetShift();
            DrawingContext drawingContext = textBoxLineDrawingVisual.RenderOpen();

            if (selectionGeometry != null)
            {
                TextBoxView      owner = this._owner;
                FrameworkElement frameworkElement;
                if (owner == null)
                {
                    frameworkElement = null;
                }
                else
                {
                    ITextBoxViewHost host = owner.Host;
                    if (host == null)
                    {
                        frameworkElement = null;
                    }
                    else
                    {
                        ITextContainer textContainer = host.TextContainer;
                        if (textContainer == null)
                        {
                            frameworkElement = null;
                        }
                        else
                        {
                            ITextSelection textSelection = textContainer.TextSelection;
                            if (textSelection == null)
                            {
                                frameworkElement = null;
                            }
                            else
                            {
                                TextEditor textEditor = textSelection.TextEditor;
                                frameworkElement = ((textEditor != null) ? textEditor.UiScope : null);
                            }
                        }
                    }
                }
                FrameworkElement frameworkElement2 = frameworkElement;
                if (frameworkElement2 != null)
                {
                    Brush brush = frameworkElement2.GetValue(TextBoxBase.SelectionBrushProperty) as Brush;
                    if (brush != null)
                    {
                        double opacity = (double)frameworkElement2.GetValue(TextBoxBase.SelectionOpacityProperty);
                        drawingContext.PushOpacity(opacity);
                        drawingContext.DrawGeometry(brush, new Pen
                        {
                            Brush = brush
                        }, selectionGeometry);
                        drawingContext.Pop();
                    }
                }
            }
            this._line.Draw(drawingContext, new Point(x, 0.0), (this._lineProperties.FlowDirection == FlowDirection.RightToLeft) ? InvertAxes.Horizontal : InvertAxes.None);
            drawingContext.Close();
            return(textBoxLineDrawingVisual);
        }