gpt4 book ai didi

wpf - Material 设计 xaml 不同窗口/控件的不同主题/调色板

转载 作者:行者123 更新时间:2023-12-02 19:49:11 27 4
gpt4 key购买 nike

使用 Material Design 工具包的 WPF。

我试图找出是否可以为窗口/用户控件设置不同的调色板/主题,以便每个窗口/u 控件都有自己的颜色主题。

最佳答案

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

关于wpf - Material 设计 xaml 不同窗口/控件的不同主题/调色板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58589504/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com