0

我怎样才能将一个UIElement重新设置为另一个窗口?在关闭窗口之前,我已将 Content 设置为 null。然后启动一个新窗口并将其UIElement设置为该窗口的内容。

这给出了 InvalidOperationException:“Het opgegeven element is al het logische onderliggende element van een ander element. Koppel dit eerst los。”

不幸的是我的窗户是荷兰的。粗略翻译如下:“指定元素已经是另一个元素的逻辑子元素,先断开连接。”

我不明白的是我已经解耦了它,但它仍然给出了这个错误。

4

1 回答 1

1

Just making the content null will not effect the parent child relation ship. You need to use RemoveLogicalChild function of window to remove the UIElement as child of the previous window and then attach it to new window.

于 2010-11-03T10:33:03.160 回答