How can you remove a wpf element by some kind of name? So sth like :
// Bar is some kind of usercontrol
Bar b = new Bar();
b.Tag = "someId";
theCanvas.Children.Add(b);
// Later to be removed without having the reference
theCanvas.Children.RemoveElementWithTag("someId")
Except ofcourse, RemoveElementWithTag isn’t an existing method…
Could just use some LINQ:
That said, I highly suspect there’s a cleaner, better performing way to achieve whatever it is you’re trying to achieve.