title: How to recognize if a rectangle contains a Text block within in
body: <p>I'm creating this program in which the user drags/drops a text block into a rectangle, and then store the contents of that specific textblock when he/she drops it into the rectangle.</p>
  
  <p>I figured out how to do the drag/drop, but I just can't figure out how to check if the rectangle contains the textblock.</p>
  
  <p>Here's the code so far: </p>
  
  <pre><code>bool captured = false;
  double x_shape, x_canvas, y_shape, y_canvas;
  UIElement source = null;
  
  
  
  private void shape_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  {
    source = (UIElement)sender;
    Mouse.Capture(source);
    captured = true;
    x_shape = Canvas.GetLeft(source);
    x_canvas = e.GetPosition(LayoutRoot).X;
    y_shape = Canvas.GetTop(source);
    y_canvas = e.GetPosition(LayoutRoot).Y;
  }
  
  private void shape_MouseMove(object sender, MouseEventArgs e)
  {
    if (captured)
    {
      double x = e.GetPosition(LayoutRoot).X;
      double y = e.GetPosition(LayoutRoot).Y;
      x_shape += x - x_canvas;
      Canvas.SetLeft(source, x_shape);
      x_canvas = x;
      y_shape += y - y_canvas;
      Canvas.SetTop(source, y_shape);
      y_canvas = y;
    }
  }
  
  private void shape_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  {
    Mouse.Capture(null);
    captured = false;
  }
  
  
  
  private void rectangle1_MouseEnter(object sender, MouseEventArgs e)
  {
      if (Mouse.Capture(null))
      {
          textBox1.Text = "test";
  
  
      }
  }
  </code></pre>
  
  <p>The "Shape" events apply to the textblock by the way, just for clarification. 
  I tried to find a shortcut and make it so with the rectangle1_MouseEnter event that if the mouse isn't clicked, then store the values (didn't include the code for the storing values). However, the problem is, this idea doesn't work because textBox1.Text="test" isn't registered, and I don't see why it isn't. </p>