[NUI] updating InternalItemsSource when header/footer is updated (#3117)
authorSangHyeon Jade Lee <sh10233.lee@samsung.com>
Fri, 28 May 2021 07:34:50 +0000 (16:34 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 1 Jun 2021 08:03:31 +0000 (17:03 +0900)
src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs

index 4edf493..062aa13 100755 (executable)
@@ -396,6 +396,10 @@ namespace Tizen.NUI.Components
                     ContentContainer.Add(value);
                 }
                 header = value;
+                if (InternalItemSource != null)
+                {
+                    InternalItemSource.HasHeader = (value != null);
+                }
                 needInitalizeLayouter = true;
                 Init();
             }
@@ -424,6 +428,10 @@ namespace Tizen.NUI.Components
                     ContentContainer.Add(value);
                 }
                 footer = value;
+                if (InternalItemSource != null)
+                {
+                    InternalItemSource.HasFooter = (value != null);
+                }
                 needInitalizeLayouter = true;
                 Init();
             }
@@ -468,6 +476,14 @@ namespace Tizen.NUI.Components
             {
                 groupHeaderTemplate = value;
                 needInitalizeLayouter = true;
+                //Need to re-intialize Internal Item Source.
+                if (InternalItemSource != null)
+                {
+                    InternalItemSource.Dispose();
+                    InternalItemSource = null;
+                }
+                if (ItemsSource != null)
+                    InternalItemSource = ItemsSourceFactory.Create(this);
                 Init();
             }
         }
@@ -487,6 +503,14 @@ namespace Tizen.NUI.Components
             {
                 groupFooterTemplate = value;
                 needInitalizeLayouter = true;
+                //Need to re-intialize Internal Item Source.
+                if (InternalItemSource != null)
+                {
+                    InternalItemSource.Dispose();
+                    InternalItemSource = null;
+                }
+                if (ItemsSource != null)
+                    InternalItemSource = ItemsSourceFactory.Create(this);
                 Init();
             }
         }