29 lines
866 B
C#
29 lines
866 B
C#
using Avalonia.Data.Converters;
|
|
using Avalonia.Media;
|
|
using demo_trade.Data.RemoteData.Entity;
|
|
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 ItemColorOrderConverter : IValueConverter
|
|
{
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
|
|
var products = (List<Product>)value;
|
|
return products.Where(it => it.Productquantityinstock < 3).ToList().Count > 0 ? new SolidColorBrush(Colors.Yellow) : new SolidColorBrush(Colors.White);
|
|
}
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
}
|