diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-12 18:38:45 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-12 18:38:45 +0200 |
| commit | 8624ae1ead48d7ddc206486db0c4fc024afac703 (patch) | |
| tree | 5ca2473a7d36d8404a012a2b4fd0d51c1d501ab6 /src/CompilerServices/CompilerServices.cs | |
| parent | ed5441de78ea4637d8e326462bf32746e8adc8bd (diff) | |
Allow one way binding with MemberLess value passed as string with ValueChanched event
Diffstat (limited to 'src/CompilerServices/CompilerServices.cs')
| -rw-r--r-- | src/CompilerServices/CompilerServices.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index 1aaeac99..f383c8ee 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -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) |