How on earth do I make a functional Windows Universal User Control Library?

Xaml has given me nothing but quirky troubles. Maybe I don't understand it enough, but all I want to do is work on my control library in one project and use the control in a different project. That shouldn't be so hard? Well, apparently it is.

Does anyone have any advice about how to get my user controls to show up in the designer of the other project? I keep getting the error in the designer of the referencing project: "cannot create an instance of [UserControl]"

I got it to work for a fraction of a second. I switched my control's "build action" to "DesignDataWithDesignTimeCreatableTypes." Suddenly it showed up in my other project. I thought I had it solved, but then I started getting "[UserControlType] doesn't contain a definition for 'InitializeComponent' … etc" in the class library project.

So, I deleted my user control and started a new one. Now it has the behavior of building fine when I build the user control as a page, but saying "does not contain a definition for 'InitializeComponent'" when I switch to "DesignDataWithDesignTimeCreatableTypes." And then it finds the "InitializeComponent" when I switch it back to "Page." But I can't see it if I build it as a page in the designer of the App project…

What is going on?

How do you make a simple Control library properly in XAML? This stuff is so easy outside of XAML.

by HonorableJudgeHolden via /r/csharp

Leave a Reply