为 Material 设计 XAML 工具包中的单个元素重新着色 - WPF

Re-colour individual elements in the Material Design XAML Toolkit - WPF

我正在使用 material design toolkit in XAML, and have three different group boxes, I would like to be able to re-colour all there headers, which are currently purple, into green, yellow and red respectively. I've looked here ,但似乎无法正确设置颜色并且不确定是否有更好的方法来执行此操作,因为颜色将特定于每个元素。

提前致谢。

我不是专家,所以我不知道这是否是正确的方法,但如果您将资源字典与您要使用的调色板放在 GroupBox 资源中,那么它会正确地为 groupbox 着色。

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

对其他组框执行相同的操作,根据需要更改调色板。