2026-06-05 13:44:39 +09:00

32 lines
835 B
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace AuroraUIComponent.UIConverter
{
public class TimeConverter : IValueConverter
{
public string StrFormat { get; } = "MM/dd HH:mm:ss.fff";
public string UnsetValue { get; } = "-";
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((DateTime)value == default(DateTime)) {
return UnsetValue;
}
return ((DateTime)value).ToString(StrFormat);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return parameter;
}
}
}