Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchView query binding not working on mvvmcross 7.0 #3936

Closed
gocmenali opened this issue Sep 24, 2020 · 6 comments · Fixed by #4231
Closed

SearchView query binding not working on mvvmcross 7.0 #3936

gocmenali opened this issue Sep 24, 2020 · 6 comments · Fixed by #4231
Labels
p/android Android platform t/bug Bug type

Comments

@gocmenali
Copy link

after updating my project mvvmcross 7.0 my searchView not works on, i tried to change searchView namespace with AndroidX, but with 7.0 either android.support.v7.widget.seearchView or androidx.appcompat.widget.searchView are not working.

This is output message and i cant solve this, i think it is about upgrading mvvmcross.
(MvxBind) Failed to create target binding for binding Query for SearchString

@winstonpang
Copy link

winstonpang commented Oct 15, 2020

I have the same issue as well, the binding does seem to be written for the androidx.appcompat.widget.SearchView though, which is what I am using.

https://github.com/MvvmCross/MvvmCross/blob/develop/MvvmCross/Platforms/Android/Binding/Target/MvxAppCompatSearchViewQueryTextTargetBinding.cs

GitHub
The .NET MVVM framework for cross-platform solutions, including Xamarin.iOS, Xamarin.Android, Windows and Mac. - MvvmCross/MvvmCross

@winstonpang
Copy link

On another note I can't find it being registered anywhere in the MvvmCross repo though.

@winstonpang
Copy link

winstonpang commented Oct 15, 2020

@gocmenali I found a work around, it appears to be a bug, potentially, that MvxAppCompatSearchViewQueryTextTargetBinding is not registered.

You just need to simply register it yourself under your AppSetup (MvxAndroidSetup).

public class AppSetup : MvxAndroidSetup<App>
    {
        protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
        {
            base.FillTargetFactories(registry);

            registry.RegisterCustomBindingFactory<View>(
                 "Query",
                  search => new MvxAppCompatSearchViewQueryTextTargetBinding(search));
        }
    }

@Cheesebaron would this cause any issues doing it this way?

@gocmenali
Copy link
Author

Thanks for your replies, i solved the problem as creating a custom searchview binding, your way is also useful

@Cheesebaron
Copy link
Member

@winstonpang should be fine. I guess I forgot to move some of the registration from the old Support libraries over when we did the AndroidX migration.

@Cheesebaron Cheesebaron added p/android Android platform t/bug Bug type labels Oct 15, 2020
@greatvova
Copy link

I've faced the same issue but with Click and LongClick bindings. I've tried to fix it with RegisterCustomBindingFactory but it does not help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/android Android platform t/bug Bug type
Development

Successfully merging a pull request may close this issue.

4 participants