Material Design WPF,如何获取颜色以在边框上使用它

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39831111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 13:55:54  来源:igfitidea点击:

Material Design WPF, how to get the color to use it on border

c#wpfmaterial-design

提问by Pierre

Everything is in the title.

一切都在标题中。

I'd like to get the color that I choose as primary in my ressources :

我想在我的资源中获得我选择的主要颜色:

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

To use it on my border BorderBrush:

在我的边界上使用它BorderBrush

<Border BorderBrush="" BorderThickness="2,0,0,0" Padding="10" >

Thanks you

谢谢

回答by mechanic

It should be something like:

它应该是这样的:

    <Border BorderBrush="{DynamicResource PrimaryHueMidBrush}" BorderThickness="2" Padding="10" Height="50" Width="300">
        <TextBlock Text="Material Design Test" />
    </Border>

You can replace PrimaryHueMidBrushwith PrimaryHueLightBrush, or PrimaryHueDarkBrush.

您可以替换PrimaryHueMidBrushPrimaryHueLightBrush, 或PrimaryHueDarkBrush

You can find more info about configuring your App.xaml at MaterailDesign documentation

您可以在MaterailDesign 文档中找到有关配置 App.xaml 的更多信息