【发布时间】:2018-05-21 07:33:53
【问题描述】:
我正在研究 MS .NET WPF;在 XAML 中,我定义了一些静态资源。我想将它们分配到一个也在 XAML 中声明的数组中。
这里是静态资源:
<local:Person x:Key="PersonABC" Name="Hello" Age="29" />
<local:Person x:Key="PersonXYZ" Name="World" Age="55" />
但我无法通过{StaticResource PersonABC} 之类的方式将它们分配到数组中。我必须重新创建资源并将它们分配到数组中:
<x:Array x:Key="PersonList" Type="{x:Type local:Person}">
<local:Person Name="Hello" Age="29" />
<local:Person Name="World" Age="55" />
</x:Array>
但我想要类似的东西:
<x:Array x:Key="PersonList" Type="{x:Type local:Person}">
"{StaticResource PersonABC}"
"{StaticResource PersonXYZ}"
</x:Array>
【问题讨论】:
标签: wpf xaml staticresource