如何设置没有出现阴影的材质设计按钮的背景?

时间:2019-07-30 14:32:40

标签: c# wpf material-design

使用材料设计时,设置按钮的背景时,会出现阴影。我将如何禁用阴影并可能去除圆角?

示例:

...
 <Button Grid.Column="1" Background="{StaticResource BurgundyLightBrush}" Command="{Binding Path=EditSwitchCommand}"  >
                <materialDesign:PackIcon Kind="Edit" />
            </Button>
...

Resulting appearance

Ideal appearance

更改边框的粗细和zindex并不能解决此问题,到目前为止,唯一的解决方案是使用选择的画笔在按钮后面添加一个矩形。到目前为止,我的解决方案是使按钮透明并在其后方放置一个矩形,但是,这似乎是“ hacky”,并且使我的xaml难以阅读。

1 个答案:

答案 0 :(得分:0)

您可以使用XAML项目中的材料设计中包含的一种样式。 我建议以下一种(针对您的用例):

  • MaterialDesignFlatButton
  • MaterialDesignIconButton
  • MaterialDesignFlatLightButton
  • MaterialDesignFlatMidButton

您应该克隆Material Design in XAML repository并签出演示应用程序以观看实时图像。

此答案假定XAML中的Material Design是最新版本(在撰写本文时为3.0.0)。

样式来源:Github