c# - 停止 Xamarin.Forms 中的 IOS 弹跳

标签 c# ios xaml xamarin.forms

我在 Xamarin.Form 中制作应用程序,我是 Xamarin 的新手。在 IOS 中,应用程序在顶部滚动时弹跳。有没有办法阻止滚动弹跳?

我尝试运行 CSS 文件但没有成功。

最佳答案

在 iOS 上有专门的属性。这是 AlwaysBounceVertical。还有一些与此相关的属性。

虽然在表单中不直接支持设置这些属性,因此您需要创建一个自定义渲染器或同等的渲染器。看看这个:

using NoBounceiOS.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly: ExportRenderer(typeof(ListView), typeof(NoBounceRenderer))]
namespace NoBounceiOS.iOS
{
    public class NoBounceRenderer : ListViewRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.AlwaysBounceVertical = false;
            }
        }
    }
}

关于c# - 停止 Xamarin.Forms 中的 IOS 弹跳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54580720/

相关文章:

c# - 如何删除 ASP.NET 网站上的 cookie

c# - 将 Action<string> 转换为 Action<object>

ios - 使用 updateApplicationContext 发送钥匙串(keychain)值是否安全

c# - 组合框不在 C# 的 DataGridView 中显示默认值

ios - Google maps swift ios mapwithframe on GMSMapView 错误

ios - Xcode 10 pod 错误

wpf - 如何使用 WPF Toolkit 将多个图表与多个系列绑定(bind)?

c# - 绑定(bind)到对象的属性

wpf - 绑定(bind)到 "object.GetType()"?

c# - 在 jqGrid 中,读取与保存单个属性/列是否有不同的值?