如何更改 Microsoft 架构版本

How to change the Microsoft schema version

直到现在 xlmns:x 对我来说似乎并不重要,但现在我想创建一个带有 "x:String" 类型数组的 ResourceDictionary。 默认 xlmns:x Namespace 引用 2006 版本,但不支持字符串。自 2009 年以来是 supported。所以我喜欢使用较新的版本。 完成它需要哪些步骤?

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2009/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                    xmlns:local="clr-namespace:HMBFipsReminderUI">
    <x:Array x:Key="DataGrid_SampleItemSource" Type="x:String">

    </x:Array>
</ResourceDictionary>

重命名没有帮助,因为 visual studio 找不到命名空间。 1. 是否有添加此命名空间的选项?

  1. 如何更改默认版本?以便在我创建新资源、页面等时使用新命名空间

Stringmscorlib 程序集的 System 命名空间中的一种类型:

xmlns:s="clr-namespace:System;assembly=mscorlib"

试试这个:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:local="clr-namespace:HMBFipsReminderUI"
                            xmlns:s="clr-namespace:System;assembly=mscorlib">
    <x:Array x:Key="DataGrid_SampleItemSource" Type="{x:Type s:String}">
        <s:String>a</s:String>
        <s:String>b</s:String>
        <s:String>c</s:String>
    </x:Array>
</ResourceDictionary>