Created
August 17, 2011 11:06
-
-
Save clausjoergensen/1151331 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Assets | |
{ | |
using System; | |
using System.Globalization; | |
using System.Windows.Data; | |
using System.Threading; | |
public class DateTimeValueConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
if (value != null) | |
{ | |
var dateTime = (DateTime)value; | |
if (dateTime != null && parameter != null) | |
{ | |
return dateTime.ToString(parameter.ToString(), culture); | |
} | |
} | |
return value; | |
} | |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
public class ShortDatePattern | |
{ | |
public override string ToString() | |
{ | |
return Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment