You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
637 B
C#

using System;
using System.Globalization;
using System.Windows.Data;
namespace SlnMesnac.WPF.Converter
{
/// <summary>
/// bool → ✓ / "" 转换器
/// </summary>
public class BoolToCheckConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool b && b)
return "✓";
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is string s && s == "✓";
}
}
}