Pablo Pardo
Pablo Pardo

Reputation: 739

xamarin.forms does not contain a definition for 'BeginRefresh()'

I'm developing a Xamarin.Forms app, and I need to filter an OnservableCollection of . I've implemented a SearchBar, and the method is quite simple, but I'm getting the problem with a ListView.BeginRefresh() method. Compiler says that this method is not found, but as I can see in the reference, the method exists.

Any clue on what could be happening?

    private void SearchBar_OnTextChanged (string filter)
    {
        lvListaCompraDef.BeginRefresh();
            lvListaCompraDef.ItemsSource = productsToBuy
                .Where (x => x.Name.ToLower ()
                    .Contains (filter.ToLower ()));
        lvListaCompraDef.EndRefresh();
    }

P.S. I can implement other listview's properties like Itemsource, but can't do it with the methods.

Upvotes: 0

Views: 465

Answers (1)

Mario Galván
Mario Galván

Reputation: 4032

Try to Clean and Rebuild your project, I have tested this and I can compile with no problems:

ListView t = new ListView ();

t.BeginRefresh ();

I have this using to reference it: using Xamarin.Forms;

also try updating to the latest Xamarin.Forms packages, and change to the stable release of Xamarin. Maybe this can help.

I am not sure what type lvListaCompraDef is but maybe you can check that.

Upvotes: 1

Related Questions