zoukankan      html  css  js  c++  java
  • lightswitch conditional formatting change color

    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.

  • 相关阅读:
    CNN的学习记录
    softmax和softmax loss的学习记录
    Vue2.0 生命周期
    Vue methods 方法
    Vue2.0 全局操作 Vue.set
    Vue2.0 自定义指令 vuedirective
    Vue2.0 构造器的延伸 Vue.extend
    vue computed
    vuecli 脚手架分析
    h5表单介绍与案例
  • 原文地址:https://www.cnblogs.com/neozhu/p/2199041.html
Copyright © 2011-2022 走看看