diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2017-06-21 10:32:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-21 10:32:08 +0200 |
commit | 28b343b2788fa073a3d3a87610275d8f3e756b61 (patch) | |
tree | d26c9aff136f95ef64aaa433b08c48f5b4d6a4f7 /Xamarin.Forms.Core/ContentPage.cs | |
parent | b7b0bf559ad8759110231d73ead0f19e53de5df7 (diff) | |
download | xamarin-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.cs | 14 |
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 |