]> O.S.I.I.S - jp/crow.git/commitdiff
Allow one way binding with MemberLess value passed as string with ValueChanched event
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 12 Sep 2015 16:38:45 +0000 (18:38 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Sat, 12 Sep 2015 16:38:45 +0000 (18:38 +0200)
src/CompilerServices/CompilerServices.cs

index 1aaeac99000f8a7f1dff1cd5e35180eb864a5d21..f383c8eea3e26e574c88abc2f56f21efe7309ed3 100644 (file)
@@ -322,13 +322,19 @@ namespace go
                                PropertyInfo piTarget = dstType.GetProperty(binding.MemberName);
 
                                Type srcValueType = null;
+
+                       if (miSrc == null)
+                               //this allow memberless binding with only a name passed as MemberName
+                               //but the value passed has to be a string
+                               srcValueType = typeof(string);
+                       else{
                                if (miSrc.MemberType == MemberTypes.Property)
                                        srcValueType = (miSrc as PropertyInfo).PropertyType;
                                else if (miSrc.MemberType == MemberTypes.Field) 
                                        srcValueType = (miSrc as FieldInfo).FieldType;
                                else
                                        throw new Exception("unandled source member type for binding");
-                               
+                       }
                                if (!srcValueType.IsValueType)
                                        il.Emit(OpCodes.Castclass, srcValueType);
                                else if (piTarget.PropertyType != srcValueType)