Focus Yourself

silverlight technology

Will Faught

1 minute

It took me several hours to figure out how to enable a Silverlight custom control to be “activated” by the space bar or enter keys like Button. It turns out when a control gets input events, it isn’t automatically given focus (i.e. OnGotFocus isn’t called). You have to call Focus() yourself. Hope this saves someone else some time.

π