using System.Globalization; using System.Windows.Data; using Leiren.Erp.Client.Pages; namespace Leiren.Erp.Client.Controls; /// Shows stored enum / flag values in Chinese (part and product types, yes/no). public sealed class DisplayTextConverter : IValueConverter { public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) => value switch { bool flag => flag ? "是" : "否", string text => ProductPage.TypeName(text), null => "-", _ => value.ToString() ?? "-", }; public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotSupportedException(); }