views:

9

answers:

1

I have a User control with 2 rectangles and buttons (Add, Delete, Clear). Upon clicking Add buttons I add more rectangles, Delete - I delete selected rectangles, and upon clicking Clear I want to return to the initial control with only 2 rectangles, so I just want to pretty much load my XAML code again, but I have no idea how to do it. Thank you!

A: 

You could reload the XAML, but it would be over-complicated and not ideal. The best way is to keep track of the objects you add (for ex putting them in a list) and removing/destroying them when you are clicking on Clear.

Francesco De Vittori
I was hoping for an easier solution, but it works too. Thanks!
Masha

related questions