using System.Globalization; namespace XiaoZhiSharp_MauiApp.Converters { public class BoolToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is bool boolValue && parameter is string parameters) { var options = parameters.Split(';'); if (options.Length == 2) { return boolValue ? options[0] : options[1]; } } return value?.ToString() ?? string.Empty; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }