31 lines
824 B
C#
31 lines
824 B
C#
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;
|
|
using Tmds.DBus.Protocol;
|
|
|
|
namespace demo_trade.UI.Converters
|
|
{
|
|
|
|
public class ItemDateConverter : IValueConverter
|
|
{
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
|
|
var date = (DateOnly)value;
|
|
return new DateTimeOffset(new DateTime(date.Year, date.Month, date.Day));
|
|
}
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
var date = (DateTimeOffset)value;
|
|
|
|
return new DateOnly(date.Year, date.Month, date.Day);
|
|
}
|
|
}
|
|
}
|