private void onContentShouldBeScrolled(object sender, ContentShouldBeScrolledEventArgs args) { if (args.MostLeftVisibleX.HasValue) { if (this.deltaX <= args.MostLeftVisibleX.Value && this.deltaX + getEffectiveWidth() > args.MostLeftVisibleX.Value) { // This X coord is already visible - do nothing } else { this.deltaX = Math.Min(args.MostLeftVisibleX.Value, Content.RenderSize.Width - getEffectiveWidth()); } } else if (args.MostRightVisibleX.HasValue) { if (this.deltaX <= args.MostRightVisibleX.Value && this.deltaX + getEffectiveWidth() > args.MostRightVisibleX.Value) { // This X coord is already visible - do nothing } else { this.deltaX = Math.Max(args.MostRightVisibleX.Value - getEffectiveWidth() + 1, 0); } } if (args.MostTopVisibleY.HasValue) { if (this.deltaY <= args.MostTopVisibleY.Value && this.deltaY + getEffectiveHeight() > args.MostTopVisibleY.Value) { // This Y coord is already visible - do nothing } else { this.deltaY = Math.Min(args.MostTopVisibleY.Value, Content.RenderSize.Height - getEffectiveHeight()); } } else if (args.MostBottomVisibleY.HasValue) { if (this.deltaY <= args.MostBottomVisibleY.Value && this.deltaY + getEffectiveHeight() > args.MostBottomVisibleY.Value) { // This Y coord is already visible - do nothing } else { this.deltaY = Math.Max(args.MostBottomVisibleY.Value - getEffectiveHeight() + 1, 0); } } this.Invalidate( ); }
private void onContentShouldBeScrolled( object sender, ContentShouldBeScrolledEventArgs args ) { if ( args.MostLeftVisibleX.HasValue ) { if ( this.deltaX <= args.MostLeftVisibleX.Value && this.deltaX + getEffectiveWidth() > args.MostLeftVisibleX.Value ) { // This X coord is already visible - do nothing } else { this.deltaX = Math.Min( args.MostLeftVisibleX.Value, Content.RenderSize.Width - getEffectiveWidth()); } } else if ( args.MostRightVisibleX.HasValue ) { if (this.deltaX <= args.MostRightVisibleX.Value && this.deltaX + getEffectiveWidth() > args.MostRightVisibleX.Value ) { // This X coord is already visible - do nothing } else { this.deltaX = Math.Max(args.MostRightVisibleX.Value - getEffectiveWidth() + 1, 0 ); } } if ( args.MostTopVisibleY.HasValue ) { if (this.deltaY <= args.MostTopVisibleY.Value && this.deltaY + getEffectiveHeight() > args.MostTopVisibleY.Value ) { // This Y coord is already visible - do nothing } else { this.deltaY = Math.Min(args.MostTopVisibleY.Value, Content.RenderSize.Height - getEffectiveHeight()); } } else if ( args.MostBottomVisibleY.HasValue ) { if (this.deltaY <= args.MostBottomVisibleY.Value && this.deltaY + getEffectiveHeight() > args.MostBottomVisibleY.Value ) { // This Y coord is already visible - do nothing } else { this.deltaY = Math.Max(args.MostBottomVisibleY.Value - getEffectiveHeight() + 1, 0 ); } } this.Invalidate( ); }