diff options
author | Seungkeun Lee <sngn.lee@samsung.com> | 2017-01-10 17:33:50 +0900 |
---|---|---|
committer | Seungkeun Lee <sngn.lee@samsung.com> | 2017-01-10 17:33:50 +0900 |
commit | dcf317090aa679899af28ecf3555283ce0a34b69 (patch) | |
tree | be79bb073632ba72e2772c489e2afed46a111103 | |
parent | 92cfa781a2ab611e2785edf67e5455ba80f07f63 (diff) | |
download | xamarin-forms-dcf317090aa679899af28ecf3555283ce0a34b69.tar.gz xamarin-forms-dcf317090aa679899af28ecf3555283ce0a34b69.tar.bz2 xamarin-forms-dcf317090aa679899af28ecf3555283ce0a34b69.zip |
Fix ListView GroupCell bug
- When ViewCell was used for GroupHeaderTemplate
ItemTemplate was used to make reusable view
- Make disable Reusable feature for GroupHeader
- Add a internal API to get low level Item object
Change-Id: I01d205a2070c813a170a6eb9aceab8f24bbdb092
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs | 19 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs index 449b6f33..94899011 100644 --- a/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs @@ -9,6 +9,8 @@ namespace Xamarin.Forms.Platform.Tizen const string _heightProperty = "Height"; readonly Dictionary<Cell, Dictionary<string, EvasObject>> _realizedNativeViews = new Dictionary<Cell, Dictionary<string, EvasObject>>(); + Native.ListView.ItemContext _currentItem; + protected CellRenderer(string style) { Class = new GenItemClass(style) @@ -109,15 +111,22 @@ namespace Xamarin.Forms.Platform.Tizen OnUnrealizedCell(cell); } + internal Native.ListView.ItemContext GetCurrentItem() + { + return _currentItem; + } + string GetText(object data, string part) { - var span = OnGetText((data as Native.ListView.ItemContext).Cell, part); + _currentItem = data as Native.ListView.ItemContext; + var span = OnGetText(_currentItem.Cell, part); return span != null ? ToNative(span).GetMarkupText() : null; } EvasObject GetContent(object data, string part) { - var cell = (data as Native.ListView.ItemContext).Cell; + _currentItem = data as Native.ListView.ItemContext; + var cell = _currentItem.Cell; EvasObject nativeView = OnGetContent(cell, part); UpdateRealizedView(cell, part, nativeView); return nativeView; @@ -125,7 +134,8 @@ namespace Xamarin.Forms.Platform.Tizen EvasObject ReusableContent(object data, string part, EvasObject old) { - var cell = (data as Native.ListView.ItemContext).Cell; + _currentItem = data as Native.ListView.ItemContext; + var cell = _currentItem.Cell; EvasObject nativeView = OnReusableContent(cell, part, old); UpdateRealizedView(cell, part, nativeView); return nativeView; @@ -148,7 +158,8 @@ namespace Xamarin.Forms.Platform.Tizen void ItemDeleted(object data) { - var cell = (data as Native.ListView.ItemContext).Cell; + _currentItem = data as Native.ListView.ItemContext; + var cell = _currentItem.Cell; _realizedNativeViews.Remove(cell); OnDeleted(cell); } diff --git a/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs index 564a1ef0..bb17ec82 100644 --- a/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs @@ -38,7 +38,7 @@ namespace Xamarin.Forms.Platform.Tizen // It is a condition for reusable the cell if (listView != null && listView.HasUnevenRows == false && - !(listView.ItemTemplate is DataTemplateSelector)) + !(listView.ItemTemplate is DataTemplateSelector) && !GetCurrentItem().IsGroupItem) { return CreateReusableContent(viewCell); } |