material 为不同 windows / 控件设计 xaml 不同的主题/调色板

material design xaml different themes / color palette for different windows / controls

WPF 使用 Material 设计工具包。

我正在尝试找出是否可以为 windows / 用户控件设置不同的调色板/主题,以便每个 window / u-control 都有自己的颜色主题。

来自 material 设计 xaml gitter chat 中的一位开发人员:

as for changing the colors on different views. Yes. You can actually take the same color resource dictionaries that you add in the App.xaml (you only need the color ones; not all of them) and apply them at whatever level in the XAML makes sense. For example if you wanted to change the primary color to Blue for all controls inside of a Grid you could do something like this:

<Grid>
    <Grid.Resources>
       <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                  <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Grid.Resources>
</Grid>