I have a viewModel with these three properties:
string searchString;
ObservableCollection<Company> ListedItems;
ICommand SearchCommand;
It represents a searchable list of companies in my database. SearchCommand searches the database based on the value of searchString, and then populates ListedItems with the results.
SearchString is bound to a textbox, while SearchCommand is bound to a button. I want to make it so that as the user types into the text box, SearchCommand is automatically executed without the user having to click the button.
At the moment, I do this via my viewModel:
public ListViewModel() {
    this.PropertyChanged += delegate(object o, PropertyChangedEventArgs e)
    {
        if (e.PropertyName == "SearchString")
            SearchCommand.Execute(null);
    };
}
Is this correct? Would it be better to have this functionality in the view? If so, how is that achieved?
 
     
     
     
    