I am attempting to add a Convert funtion to my XAML/C# application. However, the "value" object in the code below is presenting the data back as "2014-12-14", which is generating a runtime error, "Specified cast is not valid". Can anyone help me with the converstion string? I tried ParseExact, but with no success.
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
DateTime date = (DateTime)value;
return date.ToShortDateString();
}
catch (Exception ex)
{
return DateTimeOffset.MinValue;
}
}