到目前为止,XLMNS:X对我来说似乎并不重要,但是现在我喜欢创建一个带有类型" x:string"类型的ResourceDictionary。默认XLMNS:X名称空间对版本2006,但不支持字符串。自2009年以来得到了支持。因此,我喜欢使用较新的版本。完成哪些步骤?
<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.是否有添加此名称空间的选项?
- 如何更改默认版本?因此,当我创建一个新资源,页面等时,将使用新的名称空间。
String
是mscorlib
汇编的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>