How to make XmlnsDefinition work on the local assembly?

后端 未结 2 1582
名媛妹妹
名媛妹妹 2020-12-01 08:55

I\'ve started using the XmlnsDefinition attribute to tie together some CLR namespaces into a single xmlns for convenience in XAML.

Unfortunately, it seems that this

相关标签:
2条回答
  • 2020-12-01 09:42

    Unfortunately, no. The XAML file must be parsed before the assembly is built in order to generate the code implied by the XAML to be included in the assembly. The XAML compiler produces code behind files (the files ending in, for example, .g.cs) and these file then become part of the assembly the XAML file is contained in. Since the assembly hasn't been built yet, the XAML compiler cannot load it to determine XmlnsDeclaration attributes have been specified.

    0 讨论(0)
  • 2020-12-01 09:51

    Use clr-namespace instead. For example:

    xmlns:controls="clr-namespace:Rhapsody.UI.Main.Controls
    
    0 讨论(0)
提交回复
热议问题