BindCommand with Key Press Events

Skip to first unread message

Brian Jenkins

Jul 10, 2015, 11:24:21 AM7/10/15
I have a TextBox and a Button for searching. When clicking the button, a search happens. I would like the search to happen when hitting the Enter Key inside the textbox as well. I am able to get this to work using the KeyUp Event on the textbox. I was wondering if there was another way to do this using the ReactiveUI framework.

this.BindCommand(ViewModel, x => x.SearchCommand, x => x.searchButton);

TextBoxSearch.KeyUp += delegate(object sender, KeyEventArgs args)


     if (args.Key == Key.Enter)





I got this far, but couldn't figure out to make it work for just the Enter key.

this.BindCommand(ViewModel, x => x.SearchCommand, x => x.TextBoxSearch, "KeyUp");

Reply all
Reply to author
0 new messages