Silverlight 主题错误:找不到名称/键为 System.Windows.Controls.Primitives.DataGridRowHeader 的资源
我在尝试将大型项目升级到 SL4 时遇到(其他)错误。我没有写最初的主题,而且我的主题知识也不是很好。在我的 SL3 应用程序中,我有一个数据网格主题,如下所示:
<!--Datagrid Style-->
<Style TargetType="datagrid:DataGrid">
<Setter Property="RowHeaderStyle" Value="{StaticResource System.Windows.Controls.Primitives.DataGridRowHeader}"/>
<Setter Property="RowBackground" Value="Transparent"/>
<Setter Property="etc" Value="..."/>
</Style>
当我升级到 SL 4 时,上面 XAML 中的第一行给出运行时错误:
找不到名称/键为 System.Windows.Controls.Primitives.DataGridRowHeader 的资源
我应该在 SL4 中以不同方式处理此问题吗?
编辑:从给出的答案来看,这似乎永远不会起作用。就像我说的,我没有写原始主题,所以不确定它想要做什么。如果我搜索该静态资源行,它确实会出现在几个地方。你知道它试图达到什么目的吗?您认为我可以安全地删除使用这种引用方式的主题属性(在我的主题中有几个地方像这样引用了控件)?
TIA
标记
示例显示错误:
http://walkersretreat.co.nz/files/SilverlightApplication1.zip
I have got an(other) error while trying to upgrade our large project to SL4. I didn't write the original theme and my theme knowlege isn't great. In my SL3 app I have a datagrid themed like so:
<!--Datagrid Style-->
<Style TargetType="datagrid:DataGrid">
<Setter Property="RowHeaderStyle" Value="{StaticResource System.Windows.Controls.Primitives.DataGridRowHeader}"/>
<Setter Property="RowBackground" Value="Transparent"/>
<Setter Property="etc" Value="..."/>
</Style>
When I upgrade to SL 4 the first line in the XAML above gives a runtime error:
Cannot find a Resource with the Name/Key System.Windows.Controls.Primitives.DataGridRowHeader
Should I handle this differently in SL4?
EDIT: From the answer given it appears this should never have worked. Like i say i didn't write the original theme, so not sure what it's trying to do. If I do a search for that static resource line it does come up in a couple of places. Do you know what it was trying to acheive? Do you think I can safely remove the theme properties that are using this way of referencing (there aree several places where a control is referenced like this in the theme I have)?
TIA
Mark
Example showing error:
http://walkersretreat.co.nz/files/SilverlightApplication1.zip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
马克——你有同名的资源吗? SL4 XAML 解析器得到改进并且更加严格。我在项目中的任何地方都没有看到具有该名称的资源,因此解析器正在呕吐。
Mark -- do you have a resource with that name? SL4 XAML parser got improved and more strict. I don't see a resource with that name anywhere in your project so the parser is puking on it.
尝试使用 Jeff Willcox 的 Mango UT 工具包 - http:// www.jeff.wilcox.name/2011/06/updated-ut-mango-bits/
问候
Try to use Jeff Willcox's UT toolkit for Mango - http://www.jeff.wilcox.name/2011/06/updated-ut-mango-bits/
Regards