Prev | Current Page 369 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"


The ButtonBase class includes only a few members. It defines the Click event and adds
support for commands, which allow you to wire buttons to higher-level application tasks
(a feat you??™ll consider in Chapter 10). Finally, the ButtonBase class adds a ClickMode property,
which determines when a button fires its Click event in response to mouse actions. The
default value is ClickMode.Release, which means the Click event fires when the mouse is
clicked and released. However, you can also choose to fire the Click event mouse when the
mouse button is first pressed (ClickMode.Press) or, oddly enough, whenever the mouse moves
over the button and pauses there (ClickMode.Hover).
nNote All button controls support access keys, which work similarly to mnemonics in the Label control.
You add the underscore character to identify the access key. If the user presses Alt and the access key, a
button click is triggered.
CHAPTER 7 n CLASSIC CONTROLS 195
The Button
The Button class represents the ever-present Windows push button. It adds just two writeable
properties, IsCancel and IsDefault:
??? When IsCancel is True, this button is designated as the cancel button for a window. If
you press the Escape key while positioned anywhere on the current window, this button
is triggered.
??? When IsDefault is True, this button is designated as the default button (also known as
the accept button).


Pages:
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381