【问题标题】:Xamarin - WebView Pull To RefreshXamarin - WebView 拉取刷新
【发布时间】:2018-06-15 07:39:37
【问题描述】:

我在谷歌上到处搜索,似乎这个“拉动刷新”功能只适用于ListViews。有一些关于 WebView 的“Pull To Refresh”的帖子,但它们是用 Java 和 Android Studio 编码的。有什么简单的方法可以实现吗?

【问题讨论】:

    标签: c# xamarin webview pull-to-refresh


    【解决方案1】:

    您可以使用 @jamesmontemagno's PullToRefreshLayout 并将您的 WebView 包含在 PullToRefreshLayout 元素中:

    <?xml version="1.0" encoding="UTF-8"?>
    <ContentPage 
        xmlns="http://xamarin.com/schemas/2014/forms" 
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
        x:Class="RefreshSample.Views.ScrollViewXamlPage"
        xmlns:controls="clr-namespace:Refractored.XamForms.PullToRefresh;assembly=Refractored.XamForms.PullToRefresh"
        Title="Xaml Scroll">
       <controls:PullToRefreshLayout
              IsPullToRefreshEnabled="True"
              RefreshCommand="{Binding RefreshCommand}"
              IsRefreshing="{Binding IsBusy}"
              RefreshColor="Blue">
    
            <WebView>
            </WebView>
    
       </controls:PullToRefreshLayout>
    </ContentPage>
    

    【讨论】:

    • 感谢您的回复!我现在就试一试,我只需要通过nuget安装它对吗?还有一个问题,我如何添加RefreshCommand?你可以编辑并显示MainPage.xaml.cs中的c#代码吗?
    • @Denise 是的,您需要安装其 Nuget 包。文档和示例项目可以在该库的 GitHub 页面中找到。
    • 抱歉 :( 我想不通。你能告诉我如何快速完成绑定部分吗?我是 xamarin 的新手,抱歉
    猜你喜欢
    • 1970-01-01
    • 2020-12-02
    • 2019-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多