diff options
| author | j-p <jp.bruyere@live.be> | 2016-08-05 18:48:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-05 18:48:09 +0200 |
| commit | beba8120aa8f1529d79ccf0f52f02069b02aaf4d (patch) | |
| tree | 8de343d8341be621c4b5daa12899155e0bc2f26a /src/CompilerServices/Bindings.cs | |
| parent | da0cd66b6af42a3df1f35014617f1e0882ae9e63 (diff) | |
| parent | b9e90a3df66f4bd8228c1246af830d7801ea57ba (diff) | |
Merge pull request #15 from jpbruyere/TemplateImprovments
Template improvments
Diffstat (limited to 'src/CompilerServices/Bindings.cs')
| -rw-r--r-- | src/CompilerServices/Bindings.cs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/CompilerServices/Bindings.cs b/src/CompilerServices/Bindings.cs index b7967a91..40ade60d 100644 --- a/src/CompilerServices/Bindings.cs +++ b/src/CompilerServices/Bindings.cs @@ -125,9 +125,17 @@ namespace Crow } else { int ptr = 0; ILayoutable tmp = Source.Instance as ILayoutable; - if (string.IsNullOrEmpty (bindingExp [0])) { - //if exp start with '/' => Graphic tree parsing start at top container - tmp = Interface.CurrentInterface as ILayoutable; + //if exp start with '/' => Graphic tree parsing start at source + if (string.IsNullOrEmpty (bindingExp [0])) + ptr++; + else if (bindingExp[0] == "."){ //search template root + do { + tmp = tmp.Parent; + if (tmp == null) + return false; + if (tmp is Interface) + throw new Exception ("Not in Templated Control"); + } while (!(tmp is TemplatedControl)); ptr++; } while (ptr < bindingExp.Length - 1) { @@ -168,7 +176,9 @@ namespace Crow Target = new MemberReference (tmp); } if (Target == null) { + #if DEBUG_BINDING Debug.WriteLine ("Binding Source is null: " + Expression); + #endif return false; } @@ -182,7 +192,9 @@ namespace Crow return true; } + #if DEBUG_BINDING Debug.WriteLine ("Binding member not found: " + member); + #endif Target = null; return false; } |