Thursday, November 6, 2008

WPF Windows in WinForms project

Sometimes we need to add WPF windows to the Windows Forms project in Visual Studio. But, from all the WPF items,  Visual Studio allows to create only UserControl.
So I can think of two possible solutions here: a) we can create a custom item template for Visual Studio, or b) we can think something out of the UserControl.
If we do not need to create WPF windows on a constart rate, the second approach can be used.
So, we create new WPF UserControl and than replace UserControl with Window in both xaml and cs  files - in this way we get a WPF window in a WinForms project :)