clearing all usercontrol in the wpf window
How to clear all usercontrols in the wpf window. in runtime i added 开发者_JS百科dynamic usercontrols in my wpf window, when i refresh, i want to clear all those and need to load again. so how i can clear all usercontrols in my page.??
The Window class itself has a single child which you can clear by setting the Content
property to null. If you added the controls to a Panel, such as a Grid or Canvas, then you can clear them by calling the Clear method on the Children property:
myCanvas.Children.Clear();
精彩评论