title: How to add a TextBlock to a Canvas using UserControl class?
body: <p>here is the XAML...</p>
  
  <pre><code>&lt;Canvas Name="myCanvas"&gt;
    &lt;TextBlock Name="myBlock" FontFamily="Arial Black" FontSize="100" Foreground="Red" Text="R" Height="105" Width="96" Canvas.Left="61" Canvas.Top="80" /
  &lt;/Canvas&gt;
  </code></pre>
  
  <p>I have a partial class that extends a userControl. </p>
  
  <pre><code>public partial class Card : UserControl
  </code></pre>
  
  <p>I also have a test form that uses this control like this,</p>
  
  <pre><code>public formTest()
  {
    InitializeComponent();
    Card1.drawText();
    myCanvas.Children.Add(Card1); //myCanvas is defined in XAML
  }
  
  Card Card1 = new Card();
  </code></pre>
  
  <p>How do add an instance of TextBlock to myCanvas when TextBlock is inside my UserControl? So lets say,</p>
  
  <pre><code>public partial class Card : UserControl
  {
    private TextBlock txtBlock = new TextBlock();
    public Card()
    {
      txtBlock.Text = "Test";
      txtBlock.Foreground = brushFill;
    }
    public void drawText()
    {
      //uhhh idk
    }
  }
  </code></pre>
  
  <p>In general I don't understand how to get anything to display without defining it in the XAML then adding properties via code. Like this I create an instance of TextBlock, give it some properties... then I'm not sure.</p>
  
  <p>Any help is appreciated. I also know I should be using a User Control but I don't know why?</p>