From d250f7ec9af012b13b14be9cd9bda39d6de5fa9c Mon Sep 17 00:00:00 2001 From: Xianbing Teng Date: Fri, 21 Jun 2019 09:39:14 +0800 Subject: [PATCH] [NUI] Add inherit binding context support (#894) * [NUI] Add inherit binding context support * Add inherit binding context for layer --- src/Tizen.NUI/src/public/BaseComponents/View.cs | 1 + src/Tizen.NUI/src/public/Layer.cs | 1 + src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index feed447..96c8d7a 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -4030,6 +4030,7 @@ namespace Tizen.NUI.BaseComponents }; ChildAdded(this, e); } + BindableObject.SetInheritedBindingContext(child, this?.BindingContext); } } diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 93f698e..c0e1654 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -287,6 +287,7 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); Children.Add(child); + BindableObject.SetInheritedBindingContext(child, this?.BindingContext); } } diff --git a/src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs b/src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs index 63891ff..85c202b 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs @@ -47,6 +47,11 @@ namespace Tizen.NUI { self.Root.Add((View)newValue); } + var newElement = (Element)newValue; + if (newElement != null) + { + BindableObject.SetInheritedBindingContext(newElement, bindable.BindingContext); + } }); /// -- 2.7.4