Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Mon, 12 Mar 2007 16:47:17 +0200,    group: microsoft.public.windows.developer.winfx.avalon        back       


Wpf in Winform   
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!
date: Mon, 12 Mar 2007 16:47:17 +0200   author:   DAve

Re: Wpf in Winform   
Hi,

DAve wrote:
> 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! 

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
date: Tue, 13 Mar 2007 14:26:18 +0100   author:   Laurent Bugnion [MVP]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us