2
如何通过某种名称删除wpf元素?所以某事像:如何通过标签名称删除画布上的wpf元素?
// 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")
除了ofcourse,RemoveElementWithTag是不是现有的方法...
+1,因为你可以。我是这样做的,现在我正在使用一本字典。但是真的没有办法通过id或者某个元素来获取元素吗? – Peter 2009-06-27 20:48:15