Capture Silverlight 4 event when panel clicked
Posted
by Eric J.
on Stack Overflow
See other posts from Stack Overflow
or by Eric J.
Published on 2010-04-29T03:58:58Z
Indexed on
2010/06/11
7:43 UTC
Read the original article
Hit count: 410
I have a small Silverlight 4 app that essentially consists of a grid containing a label and a combo box. When I click the label, I replace it with a second text box so that I can edit the label (much the way you can edit the name of a Silverlight control in VS2010).
I have a LostFocus event handler on the text box that will end editing when the control loses focus (restoring the updated label). Trouble is, users tend to click on the panel when they are done editing rather than on another control (or hitting Enter, which is also supported).
I tried adding a left mouse down event handler to the panel. However, that only fires when the text box does not have the focus (I guess the text box captured the mouse?)
Is there an approach to recognize that a non-input control was clicked that would enable me to terminate edit mode?
© Stack Overflow or respective owner