title: How can make adorner below of controlcontent in canvas?
body: <p>I use this program: <a href="https://www.codeproject.com/Articles/24681/WPF-Diagram-Designer-Part-4" rel="nofollow noreferrer">https://www.codeproject.com/Articles/24681/WPF-Diagram-Designer-Part-4</a> and change it a bit to make a new program to draw graph(mathmatical graph) but not completed.
  for each DesignerItem I add a Text as Adorner(TextAdorner class), you can see this at:<img src="https://i.stack.imgur.com/VDvGQ.png" alt="[2"> <a href="https://i.stack.imgur.com/VDvGQ.png" rel="nofollow noreferrer">https://i.stack.imgur.com/VDvGQ.png</a></p>
  
  <p>but when two or more DesignerItems overlaped all text mixed together, because Adorner is top of all DesignerItems in canvas.
  <img src="https://i.stack.imgur.com/2kBuI.png" alt="[1"></p>
  
  <p>There is a way to make an adorner below of a DesignerItem in canvas?</p>
  
  <p>You can see TextAdorner class below.</p>
  
  <pre><code>    class TextAdorner : Adorner 
  {
      VisualCollection _visualChildren;
      Path _textGeometry;
      TexFormula formula;
      TexFormulaParser parser;
  
      public Brush ForeColor
      { get; set; }
  
      public double FontSize
      { get; set; }
      public TextAdorner(UIElement adornedElement)
         : base(adornedElement)
      {
          _visualChildren = new VisualCollection(this);
          this.Tag = @"v^{b_i}_{c_j}";
          parser = new TexFormulaParser();
          formula = parser.Parse(this.Tag.ToString());
          _textGeometry=new Path();
          this.ForeColor = Brushes.Black;
          this.FontSize = 32;
          _textGeometry.Fill = this.ForeColor;
          _textGeometry.Stroke = this.ForeColor;
          _textGeometry.StrokeThickness = 1;
          _visualChildren.Add(_textGeometry);
          this.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
      }
  
      protected override Size ArrangeOverride(Size finalSize)
      {
          double _left;
          double _top;
          _textGeometry.Data = formula.GetRenderer(TexStyle.Display, this.FontSize, "Times New Roman").RenderToGeometry(0, 0);
          switch (this.HorizontalAlignment)
          {
              case System.Windows.HorizontalAlignment.Left:
                  {
                      _left = 0;
                      break;
                  }
              case System.Windows.HorizontalAlignment.Right:
                  {
                      _left = AdornedElement.RenderSize.Width - _textGeometry.RenderedGeometry.Bounds.Width;
                      break;
                  }
              default:
                  {
                      _left = AdornedElement.RenderSize.Width / 2 - _textGeometry.RenderedGeometry.Bounds.Width / 2;
                      break;
                  }
          }
          switch (this.VerticalAlignment)
          {
              case System.Windows.VerticalAlignment.Top:
                  {
                      _top = 0;
                      break;
                  }
              case System.Windows.VerticalAlignment.Bottom:
                  {
                      _top = AdornedElement.RenderSize.Height- _textGeometry.RenderedGeometry.Bounds.Height;
                      break;
                  }
              default: 
                  {
                      _top = AdornedElement.RenderSize.Height / 2 - _textGeometry.RenderedGeometry.Bounds.Height/ 2;
                      break;
                  }
          }
          Rect _leftTopRect = new Rect(_left,_top,AdornedElement.RenderSize.Width,AdornedElement.RenderSize.Height);
          _textGeometry.Arrange(_leftTopRect);
          return finalSize;
      }
  
  
      protected override int VisualChildrenCount
      {
          get { return _visualChildren.Count; }
      }
  
      protected override Visual GetVisualChild(int index)
      {
          return _visualChildren[index];
      }
  
  }
  </code></pre>