Skip to content

How to use KeyDown event in Maui? #21557

Discussion options

You must be logged in to vote

I wrote a plugin that provides key events. You might use that approach. Use the plugin or just snag the code. I assume you would execute the same command or event you have bound to that button, not actually try to simulate a click.

Sample: https://github.com/davidortinau/GuessWord
Plugin: https://github.com/davidortinau/Plugin.Maui.KeyListener

Related, if you want to execute a command when Return is pressed on an Entry field, there's a prop ReturnCommand for that.

<Entry Placeholder="Type message"
                        Text="{Binding UserInput}"
                        ReturnCommand="{Binding SendMessageCommand}"
                    />

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@inescastro05
Comment options

Answer selected by mateusfelixmeta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants