开发者

Is there a way to include namespaces in xaml so I don't have to write the extension?

开发者 https://www.devze.com 2022-12-22 09:17 出处:网络
Is there a way to do \'using\' in XAML i.e. declare a namespace and include it in the general xaml scope so I don开发者_StackOverflow社区\'t have to write namespace:Class, just Class.There is no way t

Is there a way to do 'using' in XAML i.e. declare a namespace and include it in the general xaml scope so I don开发者_StackOverflow社区't have to write namespace:Class, just Class.


There is no way to combine namespaces in XAML that is equivalent to the C# using. XAML is first an XML format and adheres to the the XML namespace standard which doesn't support arbitrarily combining namespaces.

You can, however, change what the default namespace is for a region of XAML by using xmlns="..." attribute in an element. The xmlns attribute will change the default namespace for the element and all of its contained elements. If you find yourself using a prefix a lot consider temporarily changing the default namespace.

0

精彩评论

暂无评论...
验证码 换一张
取 消