Xamarin.forms - How to detect enter press in entry

2019-08-27 19:52发布

I am developing an xamarin forms app based on mvvm pattern. I am looking for way to detect if user type Enter button. Event should call an command from viewModel class.

Could you guys share some tips? ;)

2条回答
孤傲高冷的网名
2楼-- · 2019-08-27 20:15

You could use an event to command behavior to bind the Completed event to a command on the view model.

Details here

查看更多
ら.Afraid
3楼-- · 2019-08-27 20:24

Completed event is fired on press of enter key see this.

You can attach your event handler on Completed event like this:

var testEntry = new Entry ();

testEntry.Completed += (sender, e) => {

//Called on enter key press

};

查看更多
登录 后发表回答