summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-01-19 23:52:09 -0800
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2017-01-19 23:52:09 -0800
commitf36792e87bb1886aad856fdabbb5510af8760bdf (patch)
treec2f30a577f879f68889fb78094959aeeecf871b9
parent54a555fbecee2f29ecf54247d3e18124e52eed15 (diff)
parent28bce7b3acadf8eb4ee8decc583afd91a4a9897c (diff)
downloadxamarin-forms-f36792e87bb1886aad856fdabbb5510af8760bdf.tar.gz
xamarin-forms-f36792e87bb1886aad856fdabbb5510af8760bdf.tar.bz2
xamarin-forms-f36792e87bb1886aad856fdabbb5510af8760bdf.zip
Merge "Fixed ListView.SelectedItem Issue" into tizen
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs37
1 files changed, 17 insertions, 20 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs
index 5179d7e0..95a1d120 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs
@@ -259,7 +259,7 @@ namespace Xamarin.Forms.Platform.Tizen
if (e.Action == NotifyCollectionChangedAction.Add)
{
Cell before = null;
- if(e.NewStartingIndex + e.NewItems.Count < Element.TemplatedItems.Count)
+ if (e.NewStartingIndex + e.NewItems.Count < Element.TemplatedItems.Count)
{
before = Element.TemplatedItems[e.NewStartingIndex + e.NewItems.Count];
}
@@ -289,7 +289,7 @@ namespace Xamarin.Forms.Platform.Tizen
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
- TemplatedItemsList<ItemsView<Cell>,Cell> itemsGroup = sender as TemplatedItemsList<ItemsView<Cell>,Cell>;
+ TemplatedItemsList<ItemsView<Cell>, Cell> itemsGroup = sender as TemplatedItemsList<ItemsView<Cell>, Cell>;
Cell before = null;
if (e.NewStartingIndex + e.NewItems.Count < itemsGroup.Count)
{
@@ -407,29 +407,26 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
void UpdateSelectedItem()
{
- if (_selectedItemChanging == 0)
+ if (Element.SelectedItem == null)
{
- if (Element.SelectedItem == null)
+ if (_lastSelectedItem != null)
{
- if (_lastSelectedItem != null)
- {
- _lastSelectedItem.IsSelected = false;
- _lastSelectedItem = null;
- }
+ _lastSelectedItem.IsSelected = false;
+ _lastSelectedItem = null;
}
- else
+ }
+ else
+ {
+ var templatedItems = Element.TemplatedItems;
+ var results = templatedItems.GetGroupAndIndexOfItem(Element.SelectedItem);
+ if (results.Item1 != -1 && results.Item2 != -1)
{
- var templatedItems = Element.TemplatedItems;
- var results = templatedItems.GetGroupAndIndexOfItem(Element.SelectedItem);
- if (results.Item1 != -1 && results.Item2 != -1)
- {
- var itemGroup = templatedItems.GetGroup(results.Item1);
- var cell = itemGroup[results.Item2];
+ var itemGroup = templatedItems.GetGroup(results.Item1);
+ var cell = itemGroup[results.Item2];
- ++_selectedItemChanging;
- Control.ApplySelectedItem(cell);
- --_selectedItemChanging;
- }
+ ++_selectedItemChanging;
+ Control.ApplySelectedItem(cell);
+ --_selectedItemChanging;
}
}
}