Schlauchliner erweitert

This commit is contained in:
Damian Wessels
2023-01-29 13:53:50 +01:00
parent bbb2c45eff
commit 7db9592dff
14 changed files with 127 additions and 20 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace DaSaSo.Wpf.Converters
{
[ValueConversion(typeof(DateTime), typeof(String))]
public class StringToDateTimeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
DateTime val = (DateTime)value;
return string.Format("{0}.{1}.{2} {3}:{4}",val.Day,val.Month, val.Year, val.Hour, val.Minute);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
DateTime result;
if (DateTime.TryParse((value as string), out result))
{
return result;
}
else
{
throw new Exception();
}
}
}
}