博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
lightswitch conditional formatting change color
阅读量:7240 次
发布时间:2019-06-29

本文共 1132 字,大约阅读时间需要 3 分钟。

BTW, the best way to do a conditional color setting in LS beta 2 is to use the new SetBinding method. 

For example:

Me.FindControl("MyControl").SetBinding(TextBox.BackgroundProperty, "Value", New ColorConverter(), BindingMode.OneWay)  Public Class ColorConverter    Implements IValueConverter    Public Function Convert(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert      If CType(value, Integer) > 20 Then        Return New SolidColorBrush(Colors.Orange)      End If      Return New SolidColorBrush(Colors.Yellow)    End Function    Public Function ConvertBack(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack      Throw New NotImplementedException()    End Function  End Class
 

This will assign the background color to Orange when the value is great than 20.  With this code, we don't have to write extra code to monitor when the value is changed, and change the color again.

转载地址:http://agybm.baihongyu.com/

你可能感兴趣的文章
五.外键约束的参照操作
查看>>
走向Node与Webpack 之路 - CommonJS 模块化
查看>>
php实现随机数字、字母的验证码
查看>>
java中的包有那些 ???
查看>>
sql 加密解密函数
查看>>
[转]以下划线开头的变量名
查看>>
【转】如何通过Html网页调用本地安卓app?
查看>>
java类加载器 Bootstrap、ExtClassLoader、AppClassLoader的关系
查看>>
四、JVM垃圾回收2(垃圾收集算法)
查看>>
第五次作业
查看>>
Android:数据持久化
查看>>
站立会议01
查看>>
javascript+Struts2解决退出清空session以后,点击后退按钮显示原页面信息的问题
查看>>
Python全栈开发课堂笔记_day03
查看>>
Visio中手绘图形的填充
查看>>
SQL语句中日期相减注意事项
查看>>
实验九 根据材料编程
查看>>
HTTP详解
查看>>
使用WCF和WEBService出现配置的问题
查看>>
layer插件弹出显示圆角
查看>>