demo_trade/UI/Converters/ItemColorConverter.cs

28 lines
731 B
C#
Raw Permalink 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 ItemEnableConverterByDate : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
DateOnly date = (DateOnly)value;
return date >= DateOnly.FromDateTime(DateTime.Now);
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}