summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/ContentPage.cs
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2017-06-21 10:32:08 +0200
committerGitHub <noreply@github.com>2017-06-21 10:32:08 +0200
commit28b343b2788fa073a3d3a87610275d8f3e756b61 (patch)
treed26c9aff136f95ef64aaa433b08c48f5b4d6a4f7 /Xamarin.Forms.Core/ContentPage.cs
parentb7b0bf559ad8759110231d73ead0f19e53de5df7 (diff)
downloadxamarin-forms-28b343b2788fa073a3d3a87610275d8f3e756b61.tar.gz
xamarin-forms-28b343b2788fa073a3d3a87610275d8f3e756b61.tar.bz2
xamarin-forms-28b343b2788fa073a3d3a87610275d8f3e756b61.zip
[C] reset the BindingContext on template change (#998)
* [C] reset the BindingContext on template change * fix test
Diffstat (limited to 'Xamarin.Forms.Core/ContentPage.cs')
-rw-r--r--Xamarin.Forms.Core/ContentPage.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/ContentPage.cs b/Xamarin.Forms.Core/ContentPage.cs
index 01957c39..0804de83 100644
--- a/Xamarin.Forms.Core/ContentPage.cs
+++ b/Xamarin.Forms.Core/ContentPage.cs
@@ -22,5 +22,19 @@ namespace Xamarin.Forms
SetInheritedBindingContext(content, BindingContext);
}
}
+
+ internal override void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
+ {
+ if (oldValue == null)
+ return;
+
+ base.OnControlTemplateChanged(oldValue, newValue);
+ View content = Content;
+ ControlTemplate controlTemplate = ControlTemplate;
+ if (content != null && controlTemplate != null)
+ {
+ SetInheritedBindingContext(content, BindingContext);
+ }
+ }
}
} \ No newline at end of file