Reputation: 413
I am trying to wire-up the SearchBar control to fire a search/filter on the TextChanged Event/Trigger and not just when the Searchbar is pressed. I am using Prism & MVVM in Xamarin and would prefer to do this with commanding.
This is the code snippet for my Search:
<SearchBar Grid.Column="0" HeightRequest="40" x:Name="CampaignSearchBar"
Placeholder="Search for" Text="{Binding SearchTerms}"
TextChanged=""
SearchCommand="{Binding SearchCommand }" />
Again, I want to bind the TextChanged Event/Trigger to a Command in my ViewModel and not a Event in a page using the Prism Library. I think there is an 'EventToCommandBehavior' class in Prism that can achieve this, however, I am not able to find documentation so far.
How can I achieve this?
Upvotes: 1
Views: 2343
Reputation: 5799
If you are using a control that does not have a Bindable Command property for the event you need, you can add Prism's EventToCommandBehavior
to hook into the event you need with a Command from your ViewModel. You can find all of the documentation you need on how to use it in Prism's docs
Upvotes: 1