{
FocusedIndex = Math.Min(Container.Children.Count - 1, FocusedIndex + 1);
centerItem = Container.Children[FocusedIndex] as RecycleItem;
- centerItem.Position = new Position(0.0f, Math.Abs(StepSize * (centerItem.DataIndex)));
- centerItem.Scale = new Vector3(1.0f, 1.0f, 1.0f);
+ if (centerItem != null)
+ {
+ centerItem.Position = new Position(0.0f, Math.Abs(StepSize * (centerItem.DataIndex)));
+ centerItem.Scale = new Vector3(1.0f, 1.0f, 1.0f);
+ }
}
else if (StepSize != 0 && centerItemPosition >= stepRange.Y)
{
FocusedIndex = Math.Max(0, FocusedIndex - 1);
centerItem = Container.Children[FocusedIndex] as RecycleItem;
- centerItem.Position = new Position(0.0f, Math.Abs(StepSize * (centerItem.DataIndex)));
- centerItem.Scale = new Vector3(1.0f, 1.0f, 1.0f);
+ if (centerItem != null)
+ {
+ centerItem.Position = new Position(0.0f, Math.Abs(StepSize * (centerItem.DataIndex)));
+ centerItem.Scale = new Vector3(1.0f, 1.0f, 1.0f);
+ }
}
else
{
public IEnumerator<T> GetEnumerator()
{
- ReadOnlyCollection<T> snap = _snapshot;
- if (snap == null)
+ lock (_list)
{
- lock (_list)
- _snapshot = snap = new ReadOnlyCollection<T>(_list.ToList());
+ if (_snapshot == null)
+ {
+ _snapshot = new ReadOnlyCollection<T>(_list.ToList());
+ }
+ return _snapshot.GetEnumerator();
}
-
- return snap?.GetEnumerator();
}
public int IndexOf(T item)