wpf xaml 什么是“本地:”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5399997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 22:41:42  来源:igfitidea点击:

xaml what is "local:"?

wpfxamlxml-namespaces

提问by yozawiratama

What is local: in XAML, and what parameters in a C# class can be called local:?

什么是本地:在 XAML 中,可以调用 C# 类中的哪些参数local:

In some code I am looking at, I see xmlns:local="clr-namespace:AskLocal". What does this mean?

在我正在查看的某些代码中,我看到xmlns:local="clr-namespace:AskLocal". 这是什么意思?

回答by Erno

In XAML the local alias is commonly used when referring to the namespace in which the current class is declared. It is not mandatory, it is just commonly done.

在 XAML 中,当引用声明当前类的命名空间时,通常使用本地别名。这不是强制性的,只是通常这样做。

回答by Filip

local is an xml namespace. In this case "local" will be the alias for the namespace AskLocal.

local 是一个 xml 命名空间。在这种情况下,“local”将是命名空间 AskLocal 的别名。

It will allow you to declare resources, controls, converters etc from the AskLocal namespace directly in your xaml by using <local:nameofyourcontrol></local:nameofyourcontrol>

它将允许您直接在 xaml 中使用 AskLocal 命名空间声明资源、控件、转换器等 <local:nameofyourcontrol></local:nameofyourcontrol>