简体   繁体   中英

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(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.

Any ideas?

You can remove it using the Children collection in the grid variable:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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