none
WPF/XAML User Controls in Shared Projects

    Question

  • I'm struggling to get a WPF User Control to work in a 'Shared Project' in Visual Studio 2015.

    The problem seems to be that I can't add a new WPF User Control to the project as it doesn't appear in the list, and when I add an existing user control I don't get the correct 'Build Action' of 'Page' in the dropdown list in the file properties. All I see is: 'None', 'C# compiler', 'Content' or 'Embedded Resource'.

    The accepted answer on this question:

    https://social.msdn.microsoft.com/Forums/en-US/c0baada6-d111-40d1-b2fe-4231ed9c1efe/build-action-for-resourcedictionary-in-portable-class-library?forum=winappswithcsharp

    Has a screenshot in it that shows the Build Action of 'Page' on a .xaml file in a Shared Project... how can I get this up on mine? Am I missing some Visual Studio component that gives me this? Has this been removed since this screenshot was created?

    Wednesday, March 2, 2016 12:12 PM

Answers

All replies

  • I figured out what was going on. You can have user controls in shared projects, but only if you are running Visual Studio on a Windows 8 or above PC.

    It requires the 'Windows Phone 8 SDK' which can be downloaded standalone, but cannot be installed on Windows 7.

    You can still do shared projects on Windows 7, just not containing XAML items.
    Wednesday, March 2, 2016 8:12 PM
  • Hi adurrans,

    I'm glad that you have figured out and thanks for sharing your solution here. Please mark your reply as answer which is benefit to other communities who has the same problem.

    If any questions about Visual Studio IDE, please feel free to come back to our forum.

    Best Regards,
    Weiwei

    Thursday, March 3, 2016 2:44 AM
    Moderator