【发布时间】:2010-07-11 20:46:05
【问题描述】:
我正在尝试将资源字典添加到我的 silverlight-4 应用程序中(在 http://msdn.microsoft.com/en-us/magazine/dd419663.aspx 文章的“将视图应用于视图模型”一章中建议)。
第一个问题:我在 MainPage 中看不到任何资源。我是否正确理解我需要手动将资源字典添加到 Silverlight 应用程序中?
第二个:当我这样做时,在 Dictionary1.xaml 文件中
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib">
<DataTemplate DataType="{x:Type vm:MyViewModel}">
<vw:MyView />
</DataTemplate>
</ResourceDictionary>
我收到一个错误:无法解析符号“DataType”...
有什么好主意吗?
【问题讨论】:
-
命名空间前缀“vm”和“vw”似乎未定义。
标签: silverlight silverlight-4.0