This is the default for all controls.
Interestingly enough, the Focusable property is defined as part of the UIElement class,
which means that other noncontrol elements can also be focusable. Usually, in noncontrol
classes, Focusable will be False by default. However, you can set it to True. Try this out with a
CHAPTER 6 n DEPENDENCY PROPERTIES AND ROUTED EVENTS 173
layout container such as the StackPanel??”when it receives the focus, a dotted border will
appear around the panel??™s edge.
To move the focus from one element to another, the user can click the mouse or use the
Tab and arrow keys. In previous development frameworks, programmers have been forced to
take great care to make sure that the Tab key moves focus in a logical manner (generally from
left to right and then down the window) and that the right control has focus when the window
first appears. In WPF, this extra work is seldom necessary because WPF uses the hierarchical
layout of your elements to implement a tabbing sequence. Essentially, when you press the Tab
key you??™ll move to the first child in the current element or, if the current element has no children,
to the next child at the same level. For example, if you tab through a window with two
StackPanel containers, you??™ll move through all the controls in the first StackPanel and then
through all the controls in the second container.
Pages:
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343