开发者

WPF load new usercontrol within same window

I have a WPF window that I want replaced with another user control on a开发者_如何学运维 button click instead of a new window with .Show(). How can I do this?


If your Window has a Grid 'LayoutRoot' with the currrent Window contents within it, you can change the contents in code-behind as follows:

LayoutRoot.Children.Clear()
LayoutRoot.Children.Add(new MyUserControl());

Where MyUserControl is your new UserControl.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜