【问题标题】:C# WPF Material Design MaterialDesignFlatButton Hint\HighLight ColorC# WPF 材料设计 MaterialDesignFlatButton 提示\高光颜色
【发布时间】:2021-01-16 07:53:20
【问题描述】:

如何在我的应用中更改按钮的提示和动画颜色。 我尝试了什么:

        <!--PRIMARY-->
        <SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#349fda" />
        <SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="#333333" />
        <SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#3d5671" />
        <SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="#333333" />
        <SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="#293a4c" />
        <SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#333333" />
        
        <!--ACCENT-->
        <SolidColorBrush x:Key="SecondaryAccentBrush" Color="#349fda" />
        <SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="#349fda" />  

这改变了按钮的颜色,但我需要将动画和提示(当鼠标悬停在按钮上时)颜色从紫色(默认)更改为自定义。我该怎么做?

My buttons now looks like this

I need hint like this

【问题讨论】:

  • 有什么想法??????

标签: c# wpf button colors material-design


【解决方案1】:

您可以像这样覆盖MaterialDesignFlatButton 画笔:

<Style x:Key="CustomMaterialDesignFlatButton" 
        BasedOn="{StaticResource MaterialDesignFlatButton}"
        TargetType="{x:Type Button}">
    <Style.Resources>
        <Color x:Key="PrimaryHueMidBrushColor">Red</Color>
        <SolidColorBrush x:Key="PrimaryHueMidBrush" Color="Red" />
    </Style.Resources>
</Style>

输出:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-15
    • 2015-08-13
    • 2019-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-02
    相关资源
    最近更新 更多