gpt4 book ai didi

xml - 如何为 XAML 创建自己的(非 CLR!)XML 命名空间?

转载 作者:行者123 更新时间:2023-12-04 04:39:58 25 4
gpt4 key购买 nike

请注意 Telerik 命名空间。不是clr-namespace:Telerik;assembly=Telerik正如你所期望的那样。他们是怎么做到的?

<UserControl x:Class="Sandbox.MyUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</UserControl>

最佳答案

您可以使用 XmlnsDefinition 将一个或多个 CLR namespace 映射到一个 URI。属性;例如:

[assembly: XmlnsDefinition("http://www.yourdomain.com/schema", "MyProject.Foo")]
[assembly: XmlnsDefinition("http://www.yourdomain.com/schema", "MyProject.Bar")]
[assembly: XmlnsDefinition("http://www.yourdomain.com/schema", "MyProject.Baz")]

您也可以使用 XmlnsPrefix为命名空间关联默认前缀的属性:
[assembly: XmlnsPrefix("http://www.yourdomain.com/schema/", "foo")]

请注意,此属性仅用作编辑工具的建议。

关于xml - 如何为 XAML 创建自己的(非 CLR!)XML 命名空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19048288/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com