I have a class library that I created using the class library project template. If I right-click on this library in Solution Explorer and select Add> User Control, Visual Studio will add WinForms UserControl. This is not what I want - I want "Add> User Control" to add a WPF user control.
I already added links to WPF assemblies (WindowsBase, PresentationFramework and PresentationCore), and I already have some WPF user controls in this library, and everything compiles. My library has no references to WinForms assemblies (System.Drawing and System.Windows.Forms). But apparently, the correct links are not enough for Visual Studio, because when I try to add> User Control, it adds WinForms links to my project and creates WinForms UserControl.
I can add a WPF control to my WPF application project and then move it to my library. But this is pain, and I would prefer it to work properly first.
I think I probably missed some secret XML element in my .csproj file that tells Visual Studio which default constructor to use, and if I add the correct XML element with the correct cryptic GUID, it will start working properly . If I could create a new WPF management library, I could probably compare the two project files and figure this out. However, I am using Visual C # Express, which does not have a template for the WPF management library project, so I'm out of luck there.
What do I need to do for my class library .csproj file so that VS2010 Add> New User Control adds a WPF user control?
source
share