我有一個橢圓(前導),我想通過標記(「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
孩子?