Waterfr Villa
Waterfr Villa

Reputation: 1317

Pressing enter to do same action as double click does in wpf image button

I have created an image button which does something if double-clicked. I want pressing enter also to do the same thing. How can I do that?

Upvotes: 0

Views: 490

Answers (2)

Lightor
Lightor

Reputation: 493

You could use the KeyDown event check if e.Key == Keys.Enter then call the same function that the double click uses.

Upvotes: 0

Mark Feldman
Mark Feldman

Reputation: 16118

If it's a WPF button then do IsDefault="True" and install a regular click handler.

Upvotes: 1

Related Questions