gpt4 book ai didi

wpf - 覆盖一般按钮样式

转载 作者:行者123 更新时间:2023-12-04 13:24:56 25 4
gpt4 key购买 nike

我们在 default.xaml 中有一个通用样式,针对我们应用程序中的所有按钮。有没有办法覆盖这种样式,并基于默认按钮创建一个新按钮?

最佳答案

如果您想继承任何现有样式,请使用 BasedOn

<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}"   x:Key="RedTextBasedOnButton">  <Setter Property="Foreground" Value="Red" /> </Style>

这将继承默认样式,新的前景属性将应用于新样式

希望这可以帮助。

关于wpf - 覆盖一般按钮样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3108706/

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