![](/img/trans.png)
[英]How to remove previously updated UIElement on grid row to add new UIElement?
[英]WinRT Grid, Remove UIElement placed with Grid.SetRow(element, rowIndex)
就像標題說的那樣。 我有一個網格,可以通過Grid.SetRow()
方法將幾個元素放入其中 :
Grid.SetRow(myElement, 0);
稍后我想刪除這些項目,但我不知道如何。
只是刪除對ui元素的引用似乎並不能解決問題。
有任何想法嗎?
您可以使用grid變量中的Children
集合將其刪除:
// get grid instance
Grid grid = GetGrid();
// Remove element
grid.Children.Remove(myElement);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.