转换器
public class SourceToBooleanConverter : IValueConverter
{
// Convert enum [value] to boolean, true if matches [param]
public object Convert(object value, Type targetType, object param, CultureInfo culture)
{
return double.Parse(value.ToString()) > double.Parse(param.ToString());
}
// Convert boolean to enum, returning [param] if true
public object ConvertBack(object value, Type targetType, object param, CultureInfo culture)
{
return (bool)value ? param : Binding.DoNothing;
}
}
wpf
//Resources
<Window.Resources>
<loc:SourceToBooleanConverter x:Key="sourceToBooleanConverter" />
<Style x:Key="totalScoreStyle" TargetType="Label">
<Setter Property="FontSize" Value="24"/>
<Setter Property="Horizo