简体   繁体   English

WinRT网格,删除与Grid.SetRow(element,rowIndex)一起放置的UIElement

[英]WinRT Grid, Remove UIElement placed with Grid.SetRow(element, rowIndex)

Like the title says. 就像标题说的那样。 I have a grid into which i place several elements via the Grid.SetRow() method: 我有一个网格,可以通过Grid.SetRow()方法将几个元素放入其中

Grid.SetRow(myElement, 0);

Later on I want to remove these items but I have no idea how. 稍后我想删除这些项目,但我不知道如何。

Just dropping the reference to the ui element doesnt seem to do the trick. 只是删除对ui元素的引用似乎并不能解决问题。

Any ideas? 有任何想法吗?

You can remove it using the Children collection in the grid variable: 您可以使用grid变量中的Children集合将其删除:

// get grid instance
Grid grid = GetGrid();
// Remove element
grid.Children.Remove(myElement);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM