2017-04-25 73 views
0

到目前为止,xlmns:x对我来说似乎并不重要,但现在我喜欢用一个类型为“x:String”的数组创建ResourceDictionary。 默认xlmns:x命名空间引用版本2006,但不支持字符串。自2009年以来,它是supported。所以我喜欢使用更新的版本。 要完成这一步,哪些步骤是必需的?如何更改Microsoft架构版本

<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. 如何更改默认版本?所以,当我创建一个新的资源,页等

回答

1

String新的命名空间将被用于在System命名空间中的mscorlib组件的类型:

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>