Propagate BindingContext recursively on RecyclerViewItem. (#2928)
authorSangHyeon Jade Lee <sh10233.lee@samsung.com>
Thu, 29 Apr 2021 12:22:26 +0000 (21:22 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 7 May 2021 05:58:58 +0000 (14:58 +0900)
* Propgate BindingContext recursively on RecyclerViewItem.

propagate BindingContext to chlidren and descendant recursively
for applying binding on DataTemplate.

src/Tizen.NUI.Components/Controls/RecyclerView/Item/RecyclerViewItem.Internal.cs

index e900020..bc0e075 100755 (executable)
@@ -279,10 +279,18 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override void OnBindingContextChanged()
         {
-            foreach (View child in Children)
+            PropagateBindingContext(this);
+        }
+
+        private void PropagateBindingContext(View parent)
+        {
+            if (parent?.Children == null) return;
+            foreach (View child in parent.Children)
             {
                 SetChildInheritedBindingContext(child, BindingContext);
+                PropagateBindingContext(child);
             }
+
         }
 
         private void OnClickedInternal(ClickedEventArgs eventArgs)