簡體   English   中英

WinRT網格,刪除與Grid.SetRow(element,rowIndex)一起放置的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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM