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.

  • 相关阅读:
    POJ 3258 (NOIP2015 D2T1跳石头)
    POJ 3122 二分
    POJ 3104 二分
    POJ 1995 快速幂
    409. Longest Palindrome
    389. Find the Difference
    381. Insert Delete GetRandom O(1)
    380. Insert Delete GetRandom O(1)
    355. Design Twitter
    347. Top K Frequent Elements (sort map)
  • 原文地址:https://www.cnblogs.com/neozhu/p/2199041.html
Copyright © 2011-2022 走看看