mTapGestureDetector.Attach(this);
mTapGestureDetector.Detected += OnTapGestureDetected;
-
ClippingMode = ClippingModeType.ClipToBoundingBox;
mScrollingChild = new View();
BackgroundColor = Color.Transparent,
};
- mInterruptTouchingChild.TouchEvent += (object source, View.TouchEventArgs args) =>
- {
- return true;
- };
+ mInterruptTouchingChild.TouchEvent += OnIterruptTouchingChildTouched;
Layout = new ScrollableBaseCustomLayout();
}
+ private bool OnIterruptTouchingChildTouched(object source, View.TouchEventArgs args)
+ {
+ return true;
+ }
+
private void OnPropertyChanged(object source, PropertyNotification.NotifyEventArgs args)
{
OnScroll();
{
propertyNotification.Notified -= OnPropertyChanged;
mScrollingChild.RemovePropertyNotification(propertyNotification);
+ mScrollingChild.Relayout -= OnScrollingChildRelayout;
}
mScrollingChild = view;
propertyNotification = mScrollingChild?.AddPropertyNotification("position", PropertyCondition.Step(1.0f));
propertyNotification.Notified += OnPropertyChanged;
+ mScrollingChild.Relayout += OnScrollingChildRelayout;
}
}
{
propertyNotification.Notified -= OnPropertyChanged;
mScrollingChild.RemovePropertyNotification(propertyNotification);
+ mScrollingChild.Relayout -= OnScrollingChildRelayout;
mScrollingChild = new View();
}
}
+ private void OnScrollingChildRelayout(object source, EventArgs args)
+ {
+ // Size is changed. Calculate maxScrollDistance.
+ maxScrollDistance = CalculateMaximumScrollDistance();
+ }
+
/// <summary>
/// Scrolls to the item at the specified index.
/// </summary>
CurrentPage = index;
}
- maxScrollDistance = CalculateMaximumScrollDistance();
-
float targetPosition = Math.Min(ScrollingDirection == Direction.Vertical ? mScrollingChild.Children[index].Position.Y : mScrollingChild.Children[index].Position.X, maxScrollDistance);
AnimateChildTo(ScrollDuration, -targetPosition);
}
{
StopScroll();
}
- maxScrollDistance = CalculateMaximumScrollDistance();
totalDisplacementForPan = 0.0f;
OnScrollDragStart();
}