rabejens
rabejens

Reputation: 8162

Pull to refresh not working on ListView in Android Build with Xamarin Forms

I am currently digging into Xamarin Studio and am creating a simple sample app with a list view. This should use "Pull to refresh". I already updated the Xamarin.Forms dependency to 2.1.0.6529 everywhere it is used - the corresponding packages.config contains the following lines:

  <package id="Xamarin.Android.Support.v4" version="23.1.1.1" targetFramework="MonoAndroid60" />
  <package id="Xamarin.Forms" version="2.1.0.6529" targetFramework="MonoAndroid60" />

I double-checked that each part - the PCL one, the iOS one and the Android one - contains it.

My list view is defined in XAML like this:

        <ListView x:Name="SearchResults" ItemSelected="OnItemSelected" IsPullToRefreshEnabled="true" Refreshing="OnRefreshing">
            <!-- ListView definition -->
        </ListView>

I implemented the OnItemSelected and OnRefreshing methods.

When I run the app in the IOS simulator, Pull to refresh works, but when I run it on Android, I get a XamlParseException with the message No Property of name IsPullToRefreshEnabled found at the line which says,

this.LoadFromXaml(typeof(SearchPage));

in my SearchPage.xaml.g.cs.

The Android project is set to build for the latest platform and minimum API level 15, and I am trying to run this on API level 19. To my understanding, this should work...

What is the problem here?

Upvotes: 1

Views: 2775

Answers (2)

rabejens
rabejens

Reputation: 8162

I solved it. It was a dependency clash. What I did:

  • Removed all dependencies from the Android project
  • Added only Xamarin.Forms and its dependencies which pulled the versions it needed
  • Searched in the Add packages for Acr.UserDialogs version:*
  • Selected the newest version of the package which matches the dependencies
  • Did the same with Acr.UserDialogs.Android.AppCompat
  • Used the same dependencies in the other projects

Upvotes: 1

Saket Kumar
Saket Kumar

Reputation: 1197

Have you gone through this link ? this explains in detail Xamarin Forum Link for Pull to refresh.

Upvotes: 0

Related Questions