如何动态更改用户控件的渐变颜色? [英] How to dynamically change the gradient color of a usercontrol ?

查看:77
本文介绍了如何动态更改用户控件的渐变颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在wpf中动态更改用户控件的颜色.
当值从0更改为10时,必须显示蓝色,而值增加则必须逐渐更改为红色.温度将从0更改为30.
因此,如何随着温度的变化动态地执行操作,用户控件将必须从红色变为蓝色,反之亦然.

How to dynamically change the color of a usercontrol in wpf.
As the value changes from 0 to 10 it have to show Blue and the value increases it must gradually change to Red.The temperature will change from 0 to 30.
so how to do it dynamically as the temperature varies the usercontrol will have to change from red to blue or vice versa.

推荐答案

创建一个设置为设置属性的属性''温度''.在其中检查值并设置颜色作为结果.
Create a property which you set to set the ''temperature''. Inside this, check the value and set the color as a result.


这篇关于如何动态更改用户控件的渐变颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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