在 WPF 功能区上添加 OfficeBlack2007 主题时出现问题
我开始了一个功能区教程,一切都很顺利,直到我将这一行添加到应用主题的代码中:
this.Resources.MergedDictionaries.Add(Microsoft.Windows.Controls.Ribbon.PopularApplicationSkins.Office2007Black);
我也尝试在 XAML 中添加它,我知道它不会工作,但我还是尝试使用这个答案: WPF - MergedDictionary 在 xaml 中使用 RibbonControlsLibrary
并添加了 XAML:
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Black.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
但问题是还在那里。错误是:“查找资源字典时发生错误”,当我尝试添加 XAML 时,错误是:“命名空间 Microsoft.Windows.Controls.Ribbon 中不存在类型或命名空间名称PopularApplicatinSkins,您是否缺少装配参考?”
浏览项目文件夹时,我看不到任何名为 Theme 的文件夹。
我应该如何进行?
I started a ribbon tutorial, and everything went fine until i added this line to the code for applying the theme:
this.Resources.MergedDictionaries.Add(Microsoft.Windows.Controls.Ribbon.PopularApplicationSkins.Office2007Black);
I tried adding it in XAML as well, i know it won't work but i tried anyway using this answer:
WPF - MergedDictionary using RibbonControlsLibrary in xaml
And added the XAML:
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Black.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
But the problem is still there. The error is: "An error occurred while finding the resource dictionary" when i try adding the XAML, and the error is : "The type or namespace name PopularApplicatinSkins does not exist in the namespace Microsoft.Windows.Controls.Ribbon, are you missing an assembly reference?"
And browsing the project folder, i cannot see any folder named Theme.
How should i proceed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论