Faerdan
Topic Author
Posts: 55
Joined: 02 Oct 2015, 09:11
Location: Galway, Ireland
Contact:

Code-Behind in Referenced Assembly

19 Jul 2018, 13:41

Hi all,

When I use a code-behind class which is in the executing assembly it works fine (e.g. x:Class="CurrentAssemblyNamespace.MainWindow"), however if the class is in a referenced assembly it cannot be found (e.g. (e.g. x:Class="ReferencedAssemblyNamespace.MainWindow")).

Is this expected behaviour, or am I doing something wrong?

I have multiple projects (executable assemblies) based on the different platforms that are being supported, and keeping copies of all of the code-behind classes in each is not feasible.


Thanks,

Mark

Tags:
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Code-Behind in Referenced Assembly

19 Jul 2018, 14:28

We are not loading assemblies (should we?) but if the assembly is already loaded it should work. Could you try it? Also, could you try without specifying the assembly name?
 
Faerdan
Topic Author
Posts: 55
Joined: 02 Oct 2015, 09:11
Location: Galway, Ireland
Contact:

Re: Code-Behind in Referenced Assembly

19 Jul 2018, 15:02

Thank you, you hit the nail on the head.

I had not used any classes within the assembly before loading the Xaml, and so the CLR had not loaded the assembly.

If I use a class in the assembly, or load it with AppDomain.CurrentDomain.Load, then the Xaml works.

I can account for this in my code, so all is good.
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Code-Behind in Referenced Assembly

19 Jul 2018, 15:17

Thanks for the feedback Mark. WPF is loading the assembly so I think we should probably do the same, could you please open a ticket?
 
Faerdan
Topic Author
Posts: 55
Joined: 02 Oct 2015, 09:11
Location: Galway, Ireland
Contact:

Re: Code-Behind in Referenced Assembly

19 Jul 2018, 16:22

 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Code-Behind in Referenced Assembly

20 Jul 2018, 12:34

thanks!

Who is online

Users browsing this forum: No registered users and 1 guest