JYL
JYL

Reputation: 8319

XMLNS : a way to set them once for all?

We have multiple namespaces and assemblies in my project, and so many xmlns to declare in each control we make (at least 7, without system ones like x: or d:). It's so tedious.

Is there a way to declare xmlns once for all in the application ? If not, do you have some workarounds (in order to have a lightweight control definition) ?

Please note that I know XmlnsDefinitionAttribute, it's not always possible (with external ssemblies for example) or not a great design (for me it's not a great design to put an UI specific attribute in a business entity assembly).

Upvotes: 1

Views: 370

Answers (1)

brunnerh
brunnerh

Reputation: 184524

xmlns are a document level thing needed by the compiler, they are like using statements which you will also have to place in every C# code file.

If you have many common xmlns you could create an item template for Visual Studio which adds them by default, or find an extension which allows for something like Snippets in XAML.

Upvotes: 4

Related Questions