Browse Source

Throw not implemented exception placeholder.

pull/554/head
danwalmsley 10 years ago
parent
commit
2e9c19beaf
  1. 32
      src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs

32
src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs

@ -42,7 +42,7 @@ namespace Avalonia.Controls.Presenters
if (panel.PixelOffset > 0) if (panel.PixelOffset > 0)
{ {
panel.PixelOffset = 0; panel.PixelOffset = 0;
delta += 1; delta += 1;
} }
if (delta != 0) if (delta != 0)
@ -87,6 +87,18 @@ namespace Avalonia.Controls.Presenters
switch (e.Action) switch (e.Action)
{ {
case NotifyCollectionChangedAction.Remove:
if (e.OldStartingIndex == ItemCount)
{
NextIndex = ItemCount - 1;
throw new NotImplementedException("Remove the last item from the panel.");
}
CreateRemoveContainers();
RecycleContainers();
break;
case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Add:
if (e.NewStartingIndex >= FirstIndex && if (e.NewStartingIndex >= FirstIndex &&
e.NewStartingIndex + e.NewItems.Count < NextIndex) e.NewStartingIndex + e.NewItems.Count < NextIndex)
@ -183,17 +195,25 @@ namespace Avalonia.Controls.Presenters
foreach (var container in containers) foreach (var container in containers)
{ {
var item = Items.ElementAt(itemIndex); if (itemIndex < ItemCount)
if (!object.Equals(container.Item, item))
{ {
if (!generator.TryRecycle(itemIndex, itemIndex, item, selector)) var item = Items.ElementAt(itemIndex);
if (!object.Equals(container.Item, item))
{ {
throw new NotImplementedException(); if (!generator.TryRecycle(itemIndex, itemIndex, item, selector))
{
throw new NotImplementedException();
}
} }
} }
else
{
panel.Children.RemoveAt(panel.Children.Count - 1);
}
++itemIndex; ++itemIndex;
} }
} }

Loading…
Cancel
Save