如何更改通用 Windows 平台应用程序中单击事件按钮的背景颜色? [英] How to change the background color of button on Click Event in Universal Windows Platform Apps?
本文介绍了如何更改通用 Windows 平台应用程序中单击事件按钮的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在 Windows 10 中开发 UWP 应用程序,我正在尝试更改单击事件中按钮的背景颜色.这是我的代码:
I'm working on a UWP app in windows 10 and I am trying to change the background color of a button in a click event. This is my code:
private void button1_1_Click(object sender, RoutedEventArgs e)
{
if (_Sign)
{
button_1_1.Content = "Cross";
_Sign = false;
}
else
{
// button_1_1.Background = new SolidColorBrush(new Windows.UI.Color )
// indows.UI.Colors clr = new Windows.UI.Colors(new SolidColorBrush red);
// SolidColorBrush color = new SolidColorBrush();
// color = new SolidColorBrush.
// button_1_1.Background = clr;
button_1_1.Content = "Tick";
_Sign = true;
}
}
推荐答案
使用 颜色属性:
button_1_1.Background = new SolidColorBrush(Windows.UI.Colors.White);
这篇关于如何更改通用 Windows 平台应用程序中单击事件按钮的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文