0

I have 2 canvas components and I want these to be synchronized at all times. Once i add a rectangle to canvas 1, I also add it to canvas 2. I remove the rectangle within canvas 1 in the following way:

Rectangle rec = Mouse.DirectlyOver as Rectangle;
if (rec != null)
{
       drawCanvas.Children.Remove(rec);
       drawCanvas.UpdateLayout();
}

How would i delete the rectangle at the same position within canvas 2?

Snr Naldo
  • 113
  • 1
  • 12
  • 1
    Couldn't you just bind both canvas to the same source? – Jose Jul 04 '16 at 11:42
  • 1
    See [this answer](http://stackoverflow.com/a/22325266/1136211) about how to add Rectangles to a Canvas in an MVVM manner. Then bind two such ItemsControls to the same view model. – Clemens Jul 04 '16 at 11:50
  • I have used an observablecollection and have done exactly that, thx guys ;) – Snr Naldo Jul 06 '16 at 22:41

0 Answers0