我有一个椭圆(前导),我想通过标记(“p”)从帆布(canvas1)中删除。 我想这一点,但它不工作:通过标记去除帆布子(
var child = (from c in canvas1.Children
where "p".Equals(c.Tag)
select c).First();
canvas1.Children.Remove(child);
它给了我这个错误:
"Could not find an implementation of the query pattern for source type 'System.Windows.Controls.UIElementCollection'. 'Where' not found. Consider explicitly specifying the type of the range variable 'c'."
我怎么能按标签删除canvas
孩子?