Files
Leiren.Erp/src/Leiren.Erp.Client/Controls/DisplayTextConverter.cs
T
2026-11-16 18:25:21 +08:00

21 lines
718 B
C#

using System.Globalization;
using System.Windows.Data;
using Leiren.Erp.Client.Pages;
namespace Leiren.Erp.Client.Controls;
/// <summary>Shows stored enum / flag values in Chinese (part and product types, yes/no).</summary>
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();
}