Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a reference of default keyboard behaviours for Silverlight 4 controls? [closed]

In the official Microsoft documentation there's only one paragraph mentioning how controls behave to keyboard (at least what I could find):

http://msdn.microsoft.com/en-us/library/cc189015(v=VS.95).aspx#inputting_text

Text Input and Controls

Certain controls react to keyboard events with their own handling. For instance, a TextBox is a control that is designed to capture and then visually represent text that was entered by using the keyboard, and it uses KeyUp and KeyDown in its own logic to capture keystrokes, then also raises its own TextChanged event if the text actually changed. You can still generally add handlers for KeyUp and KeyDown to a TextBox, or any related control that is intended to process text input. However, as part of its intended design, a control might not respond to all key values that are directed to it through key events. Behavior is specific to each control. As an example, ButtonBase (base class for Button) processes KeyUp so that it can check for the SPACEBAR or ENTER key, which it considers equivalent to a mouse left button down for purposes of raising a Click event. This processing of the event is accomplished by ButtonBase overriding the virtual method OnKeyUp, and in its implementation it sets Handled = true. The result is that any parent of a button listening for a key event in the case of a SPACEBAR would not receive the already-handled event for its own handlers. Another example is TextBox. Some keys such as the ARROW keys are not considered text by TextBox and are instead considered specific to the control UI behavior, and the TextBox marks these event cases as handled.

Custom controls can implement their own similar override behavior for key events by overriding OnKeyDown / OnKeyUp. If your custom control processes specific accelerator keys, or has control or focus behavior that is similar to the scenario described for TextBox, you should place this logic in your own OnKeyDown / OnKeyUp overrides.

Is there a more complete reference anywhere?

For example in an AutoCompleteBox you can navigate to suggestions pressing up / down and choose one pressing enter, etc etc.

Surely there must be a better way than focusing every single control and pressing every single key on the keyboard to find out :)

like image 764
dain Avatar asked Nov 17 '10 18:11

dain


2 Answers

Look in source code \ Reflector.

There are lots of quirks in controls text processing, I doubt that any one will care to document this. For instance KeyDown event of TextBox is not fired when user presses BackSpace when there is text inside control, but fires when the is no text, etc. The quickest way to find how something work is to dig into source.

I have figured a nice rule: if for some reason you need to know how some control will behave is some situation don't waste you time trying to code (reproduce) this situation, just get Reflector and look at source code.

like image 113
Alex Burtsev Avatar answered Nov 02 '22 09:11

Alex Burtsev


Here is the link for the official ms short cuts, http://support.microsoft.com/kb/126449 tThey are being added to for Windows 8 http://www.itworld.com/software/203881/windows-8-metro-keyboard-shortcuts-and-tips hope this helps

like image 38
Ian P Avatar answered Nov 02 '22 08:11

Ian P