zhangyiying
zhangyiying

Reputation: 424

Change Application.ResourceAssembly in WPF?

This is a question that puzzled me.

In beginning, Application.ResourceAssembly is null;

Application.ResourceAssembly = assembly1;  // it's ok
Application.ResourceAssembly = assembly2;  // It will has a error.

A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll

So, can Application.ResourceAssembly be assigned if it isn't null??

Upvotes: 0

Views: 1734

Answers (1)

Yogesh
Yogesh

Reputation: 14608

The problem is that you are trying to set Application.ResourceAssembly twice. You can only set it ONCE.

Here is the MSDN quote from Application.ResourceAssembly Property page:

ResourceAssembly can only be set once because it is unlikely that the resource assembly will change after the WPF assembly is loaded.

Upvotes: 2

Related Questions