private void OnScrollChanged(object sender, ScrollChangedEventArgs e) { //Do we need to update the offset? if (IsEnabled) { var horizontal = e.HorizontalChange; var vertical = e.VerticalChange; //VerticalOffset means two seperate things based on the CanContentScroll //property. If this property is true then the offset is the number of //items to scroll; false then it's in Device Independant Pixels (DIPs). if (_scrollViewer.CanContentScroll) { //We need to either increase the offset or decrease it. if (e.VerticalChange < 0) { var start = (int)e.VerticalOffset; var end = (int)(e.VerticalOffset - e.VerticalChange); vertical = -CalculateOffset(start, end); } else { var start = (int)(e.VerticalOffset - e.VerticalChange); var end = (int)e.VerticalOffset; vertical = CalculateOffset(start, end); } } _offset.X += horizontal; _offset.Y += vertical; OffsetChanged?.Invoke(this, new OffsetChangedEventArgs(horizontal, vertical)); } }
private void SliderOnOffsetChanged(object sender, ValueChangedEventArgs e) { OffsetChanged?.Invoke(sender, e); if (sender != SliderEntry) { XamarinHelpers.EnsureMainThread(() => { SliderEntry.Text = e.NewValue.ToString(CultureInfo.InvariantCulture); }); } }
private void UpdateVerticalOffset() { var yDiff = _touchEndPosition.y - _touchStartPosition.y; if (Mathf.Abs(yDiff) > Tolerance) { OffsetChanged.Invoke(yDiff); } }
protected virtual void OnOffsetChanged() { Invalidate(); OffsetChanged.Fire(this); }
protected void OnOffsetChanged() { OffsetChanged?.Invoke(this, EventArgs.Empty); }