Created
May 16, 2012 14:24
-
-
Save butaji/2710736 to your computer and use it in GitHub Desktop.
Typed converter
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
public abstract class TypedConverter<TFrom, TTo> : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
if (value is TFrom) | |
return Convert((TFrom)value); | |
return Convert(default(TFrom)); | |
} | |
public abstract TTo Convert(TFrom value); | |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
throw new NotImplementedException(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment