diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs index 47019051..449b6f33 100644 --- a/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs @@ -16,6 +16,7 @@ namespace Xamarin.Forms.Platform.Tizen GetTextHandler = GetText, GetContentHandler = GetContent, DeleteHandler = ItemDeleted, + ReusableContentHandler = ReusableContent, }; } @@ -50,6 +51,11 @@ namespace Xamarin.Forms.Platform.Tizen { } + protected virtual EvasObject OnReusableContent(Cell cell, string part, EvasObject old) + { + return null; + } + protected int FindCellContentHeight(Cell cell) { ViewCell viewCell = cell as ViewCell; @@ -97,7 +103,9 @@ namespace Xamarin.Forms.Platform.Tizen internal void SendUnrealizedCell(Cell cell) { - _realizedNativeViews.Remove(cell); + Dictionary<string, EvasObject> realizedView = null; + _realizedNativeViews.TryGetValue(cell, out realizedView); + realizedView?.Clear(); OnUnrealizedCell(cell); } @@ -111,6 +119,20 @@ namespace Xamarin.Forms.Platform.Tizen { var cell = (data as Native.ListView.ItemContext).Cell; EvasObject nativeView = OnGetContent(cell, part); + UpdateRealizedView(cell, part, nativeView); + return nativeView; + } + + EvasObject ReusableContent(object data, string part, EvasObject old) + { + var cell = (data as Native.ListView.ItemContext).Cell; + EvasObject nativeView = OnReusableContent(cell, part, old); + UpdateRealizedView(cell, part, nativeView); + return nativeView; + } + + void UpdateRealizedView(Cell cell, string part, EvasObject nativeView) + { if (part != null && nativeView != null) { Dictionary<string, EvasObject> realizedView = null; @@ -121,13 +143,7 @@ namespace Xamarin.Forms.Platform.Tizen _realizedNativeViews[cell] = realizedView; } realizedView[part] = nativeView; - - nativeView.Deleted += (sender, e) => - { - realizedView.Remove(part); - }; } - return nativeView; } void ItemDeleted(object data) |