Chrisjan Lodewyks
Chrisjan Lodewyks

Reputation: 1337

Application Wide WPF Namespace

In my WPF Application I find myself adding the following namespace to every control:

xmlns:Core="clr-namespace:MHA.Modules.Core;assembly=MHA.Modules.Core"

Is there a way I can only add this namespace once and that it will be available application wide?

Thanx

Upvotes: 2

Views: 417

Answers (1)

Steoates
Steoates

Reputation: 3168

Sadly there is no way that I know off to do this..

What you could do instead is use the XmlnsDefinitions which would tidy this up considerably and would also give you abit of of future proofing if you decide to add something new to the core but in a different name space.

in your AssemblyInfo file, add the following

[assembly: XmlnsDefinition("COMMON-URL", "MHA.Modules.Core")]

you can also add multiple namespaces under one URL.

then you could reference it in your XAML like

xmlns:Core="COMMON-URL"

for more information - see http://zachbonham.blogspot.co.uk/2010/04/organize-xaml-namespace-declarations.html

cheers. ste.

Upvotes: 1

Related Questions