WPF - MergedDictionary using RibbonControlsLibrary in xaml

断了今生、忘了曾经 提交于 2019-12-11 17:12:38

问题


In code behind, this works:

 this.Resources.MergedDictionaries.Add(Microsoft.Windows.Controls.Ribbon.PopularApplicationSkins.Office2007Black);

How do I do this in xaml?


回答1:


Try the following:-

<Window x:Class="WPFRibbon.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
    Title="Window1" Height="300" Width="400">

<Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Black.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
</Window.Resources>


来源:https://stackoverflow.com/questions/699001/wpf-mergeddictionary-using-ribboncontrolslibrary-in-xaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!