Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we bind the search text entered in a SearchView in Android via mvvmcross

I am developing an app in Xamarin Android along with MvvmCross. MvvmCross helps to bind view properties in layout directly to ViewModels. For EditText, we can bind the text like

<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    local:MvxBind="Text Property" />

I need to bind SearchView text using MvvmCross. I tried Text like below but it doesn't work.

<SearchView     
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:queryHint="Customer name" 
    local:MvxBind="Text SearchString" />

How Is it possible to bind SearchView text using MvvmCross?

like image 611
sJy Avatar asked Mar 11 '23 08:03

sJy


1 Answers

For SearchView you need to use the Query property:

<SearchView     
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:queryHint="Customer name" 
    local:MvxBind="Query SearchString" />
like image 75
Cheesebaron Avatar answered Mar 21 '23 19:03

Cheesebaron