FModel/FModel/Views/Resources/Converters/DateTimeToDateConverter.cs
2024-09-25 18:38:01 +02:00

25 lines
648 B
C#

using System;
using System.Globalization;
using System.Windows.Data;
namespace FModel.Views.Resources.Converters;
public class DateTimeToDateConverter : IValueConverter
{
public static readonly DateTimeToDateConverter Instance = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DateTime dateTime)
{
return DateOnly.FromDateTime(dateTime);
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}