开发者

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application.

Could you explain me how this is don开发者_如何学Ce.


You need to use an ElementHost.

ElementHost es = new ElementHost();
es.HostContainer.Children.Add(screen); // where screen is your wpf window or user control

es.Dock = Windows.Forms.DockStyle.Fill; // probably want to fill the element host. Not necessary
somePanel.Controls.Add(es); // add the element host to a panel on your Winform or the form itself

Hope that helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜