Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Wpf in Winform

0 views
Skip to first unread message

DAve

unread,
Mar 12, 2007, 10:47:17 AM3/12/07
to
Hi,
I have a c# winform application in VS2005 and i add to that application a
wpf window (add new item -> Window(wpf))
now i chenge the build mode to the xaml to page and it compile ok but how do
i create instance of that window from my winform form and open the wpf
window????
thanks!


Laurent Bugnion [MVP]

unread,
Mar 13, 2007, 9:26:18 AM3/13/07
to
Hi,

I just tried, and I cannot even compile. However, the following works
for me:

- Add a new WPF project (WPF Custom control library for example).

- Add a Window to this WPF project

- In your WinForms project, reference the following libraries:
PresentationCore, PresentationFramework and WindowBase (from the .NET tab)

- In your WinForms code-behind, use:

private void button1_Click( object sender, EventArgs e )
{
CustomControlLibrary1.Window1 window
= new CustomControlLibrary1.Window1();
window.Show();
}

Let me know if it works.


Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

0 new messages