我正在使用 Fluent-Ribbons 在 wpf 中创建我的视图。为了更好地组织我的代码,我想将不同的 RibbonTabItems 放入它们自己的文件中。
问题是:设计器没有显示功能区选项卡的内容。我只看到一个空白页。
有没有办法让 RibbonTab 在设计器中可见?
我正在使用 Fluent-Ribbons 在 wpf 中创建我的视图。为了更好地组织我的代码,我想将不同的 RibbonTabItems 放入它们自己的文件中。
问题是:设计器没有显示功能区选项卡的内容。我只看到一个空白页。
有没有办法让 RibbonTab 在设计器中可见?
如果其他人从谷歌登陆这里,我会遇到这种情况,即功能区不仅在设计器中不可见,而且在运行时也不显示。花了一些时间后,我发现您已将通用 fluent 功能区主题资源导入您的窗口或应用程序资源部分,如下所示:
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
在此之后,我的功能区开始在设计器和运行时显示。
您也可以以相同的方式使用其他主题。只需像这样覆盖通用主题:
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Generic.xaml" />
<!-- change "Cobalt" to the color you want -->
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Themes/Dark.Cobalt.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
希望这对未来的人有所帮助。
归功于 github上的项目文档。