WPF - 在xaml中使用RibbonControlsLibrary的MergedDictionary

时间:2009-03-30 21:02:12

标签: wpf xaml ribboncontrolslibrary

在代码背后,这有效:

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

我如何在xaml中执行此操作?

1 个答案:

答案 0 :(得分:2)

请尝试以下方法: -

<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>