小编Pat*_*aix的帖子

WPF MahApps.Metro - 在哪里放置ResourceDictionaries?

我正在使用MahApps.Metro,版本0.11.0.9-ALPHA for .NET 4.5.并想知道引用其资源词典的最佳方式.

有人告诉我,我不应该在App.xaml中将它们作为合并字典引用.如果不是这样,我是否需要为每个窗口添加它们作为Window.Resources?

我这样做:

    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

</Application.Resources>
Run Code Online (Sandbox Code Playgroud)

这个问题是一些控件表现得很时髦,例如窗口上的最小化,最大化和关闭按钮显示为没有文本的黑色块.当我将这些资源字典引用为Window.Resources时,一切正常......

wpf xaml resourcedictionary microsoft-metro

5
推荐指数
1
解决办法
2677
查看次数

标签 统计

microsoft-metro ×1

resourcedictionary ×1

wpf ×1

xaml ×1