Forums

Difficulties creating a UserControl
Last Post 07 Jul 2016 07:26 PM by ellisonch. 21 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Page 2 of 2 << < 12
Author Messages Resolved
Filip DušekUser is Offline
Advanced Member
Advanced Member
Posts:690


--
07 Jul 2016 03:25 PM
Got few spare mins so I added it - https://github.com/EmptyKeys/UI_Examples/tree/master/BasicUI_MonoGame

If you want user controls at the same project, you have to use /da UI Generator command line option and just simple xlmns in XAML file.
ellisonchUser is Offline
New Member
New Member
Posts:23


--
07 Jul 2016 07:26 PM
Fantastic! Thanks Filip! I managed to get this to work in my project now, by looking at the changes you made to the example.

I don't know about the multi-project way of doing it, but I was doing at least two things wrong in the single project way. I strongly prefer the single project way anyway, so this is great.

Problem 1, I was not using the /da option, and if I had, I probably would have used the wrong assembly. Based on the description, I would definitely have used the assembly the real control actually was in, not the assembly the .xaml was in. I still don't really understand what hocus pocus is going on, but I'm okay as long as it works.

Problem 2, when one adds a new user control xaml file (let's say Foo.xaml) to VS, it starts with
x:Class="DefaultNS.Foo"
. When you change DefaultNS to be another NS, it doesn't change the underlying Foo.xaml.cs to match. You have to manually edit it to change the namespace, which is something I didn't realize.

It was pretty easy with the example, but I never would have figured it out without it. Thanks!
You are not authorized to post a reply.
Page 2 of 2 << < 12