如何更改按钮的Windows Phone应用程序的背景颜色? [英] How to change the background color of button in windows phone application?

查看:94
本文介绍了如何更改按钮的Windows Phone应用程序的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的窗口手机在C#和放大器7应用程序; Silverlight的4我是新来的silverlight.I在我为不同的目的应用两个按钮。我想动态改变按钮的颜色按钮被点击的时候。所以我用下面的code

I am developing window phone 7 application in C# & silverlight 4. I am new to the silverlight.I have two buttons in my application for different purposes. I want to change the color of the button dynamically when the button gets clicked. So I am using the following code

 IncomeButton.Background = new SolidColorBrush(Colors.Red);

但它不工作。能否请您给我提供任何code或链接,通过它我可以解决上述问题?如果我做错什么,那么请指导我。

But it is not working. Can you please provide me any code or link through which I can resolve the above issue ? If I am doing anything wrong then please guide me.

推荐答案

改变从它自己的click事件的按钮的造型带有一个陷阱。彼得在这里阐述

Changing the styling of a button from it's own click event comes with a catch. Peter elaborates here.

<一个href=\"http://blogs.msdn.com/b/ptorr/archive/2010/06/18/why-can-t-i-change-the-background-of-my-button-on-a-click-event.aspx?CommentPosted=true#commentmessage\"相对=nofollow>为什么我不能改变我的按钮上点击事件的背景是什么? - 彼得托的博客

这篇关于如何更改按钮的Windows Phone应用程序的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆