按键引用ResourceDictionary并将其用作窗口/控件资源

时间:2015-12-25 12:33:38

标签: c# wpf xaml resourcedictionary

是否可以通过ResourceDictionary而不是相对路径引用“嵌套”x:Key

的App.xaml

<Application>
    <Application.Resources>
        <ResourceDictionary>

            <ResourceDictionary x:Key="MyConstants" Source="Foo/Bar/MyConstants.xaml"/>

            <!-- other stuff -->

        </ResourceDictionary>
    </Application.Resources>
</Application>

MainWindow.xaml

<Window.Resources>

    <ResourceDictionary KeyReference="MyConstants"/>

</Window.Resources>

0 个答案:

没有答案