wpf - 如何更改 wpf 中按钮的内容 "color"

标签 wpf button colors

<StackPanel Margin="2">
  <Button Name="btn" Click="btn_Click" Content="Load Profile Image">
    <Button.Background>
      <ImageBrush ImageSource="D:\Pictures\rectangles.jpg"></ImageBrush>
    </Button.Background>
  </Button>
</StackPanel>

我在这里粘贴的图像几乎是黑色的,所以我想将内容颜色更改为白色,以便它应该正确显示。

我的道歉,我没有在标题中添加颜色,用逗号引用,抱歉我的错误。现在可以了,我想现在读者很清楚了 ;)

最佳答案

假设您正在谈论要显示的文本的颜色,您需要 Foreground属性(property)。

<Button Name="btn" Click="btn_Click" Content="Load Profile Image" Foreground="White">

关于wpf - 如何更改 wpf 中按钮的内容 "color",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28555219/

相关文章:

delphi - 使用 cairo、librsvg 和 delphi 绘制 SVG,更改所有路径的颜色

c# - 在 UWP XAML 中动态绑定(bind) NavigationViewItem && NavigationViewItemHeader

wpf - SelectedColor 绑定(bind)不会从 ColorPicker 更新到 Model

c# - 是否可以使用 Microsoft Automation UI 在 WPF/WinForm App 上单击标签控件

c# - .如何使用 "..."截断 DataGridTextColumn LongText

android - 在安卓手机上测试时无法显示整个屏幕

java - 删除按钮的矩形边框

Java for循环迭代并列出颜色

JavaScript:如何让单击按钮时显示图像?

c - 在 C 中获取操作系统的默认颜色