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];
}
{
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)
{
/// </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;
}
}
}