Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user