demo_trade/UI/Converters/ItemComboboxConverter.cs

31 lines
764 B
C#
Raw Normal View History

2024-10-04 12:41:04 +00:00
using Avalonia.Data.Converters;
using Avalonia.Media;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace demo_trade.UI.Converters
{
public class ItemComboboxConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
string status = (string)value;
return status == "Новый" ? 0: 1;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
int status = (int)value;
return status != 0 ? "Завершен" : "Новый";
}
}
}