How to make an invisible button to run a command
Posted
by Denis Mitropolskiy
on Stack Overflow
See other posts from Stack Overflow
or by Denis Mitropolskiy
Published on 2010-03-30T20:33:13Z
Indexed on
2010/03/30
21:23 UTC
Read the original article
Hit count: 340
wpf
I have a form with TextBox and two Buttons. One button has IsDefault property set to true, and IsCancel set to true for other button. TextBox is CommandTarget for both buttons. When I'm pressing Enter or ESC keys on TextBox, it works as I'm pressing on corresponding button.
I want to remove buttons from the form. They should not be visible, but the textbox should react on Enter or ESC as before. I cannot just set button's Visible property to collapsed - in this case they does not work at all. And I prefer to avoid of tracking keyboard events. Is it possible?
© Stack Overflow or respective owner