Created
August 10, 2009 20:59
-
-
Save jacksonh/165412 to your computer and use it in GitHub Desktop.
This file contains 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
Index: class/System.Windows/Mono/MoonlightTypeConverter.cs | |
=================================================================== | |
--- class/System.Windows/Mono/MoonlightTypeConverter.cs (revision 139643) | |
+++ class/System.Windows/Mono/MoonlightTypeConverter.cs (working copy) | |
@@ -67,6 +67,9 @@ | |
if (IsAssignableToIConvertible (sourceType) && IsAssignableToIConvertible (destinationType)) | |
return true; | |
+ if (destinationType.IsEnum && Enum.GetUnderlyingType (destinationType).IsAssignableFrom (sourceType)) | |
+ return true; | |
+ | |
return base.CanConvertFrom (context, sourceType); | |
} | |
@@ -102,6 +105,9 @@ | |
return new FontStretch ((FontStretchKind) Enum.Parse (typeof (FontStretchKind), str_val, true)); | |
} | |
+ if (destinationType.IsEnum && Enum.IsDefined (destinationType, value)) | |
+ return Enum.ToObject (destinationType, value); | |
+ | |
if (value is Color && destinationType.IsAssignableFrom(typeof(SolidColorBrush))) { | |
return new SolidColorBrush ((Color)value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment