namespace GDNXFD.Alert.Config.Converters { using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; public class BooleanToEnabledDisabledConverter : IValueConverter { private const string EnabledText = "启用"; private const string DisabledText = "停用"; public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return Equals(true, value) ? EnabledText : DisabledText; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { //Actually won't be used, but in case you need that return Equals(value, EnabledText); } } }