Apr 092012
 

In Visual Studio 2010, depending on the project type you get different options when you want to add new items to a project. If you have created a class library and later you figure out that you want to add WPF custom controls, you will need to change the project so that it supports this functionality.

Changing the project type is an easy task. You need to open up the .csproj file in a text editor and add the following tag under the <PropertyGroup> element:

<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

You will also need to add the following WPF references with Visual Studio:

  • PresentationCore
  • PresentationFramework
  • System.Xaml
  • WindowsBase

Once everything is done, you can add a new CustomControl to the project:

image thumb Converting a class library to WPF control library

  • K Rol

    Still working with Visual Studio 2015
    Thanks!