If IsThreeState is False (the default), clicking the check box alternates its state
between checked and unchecked, and the only way to place it in an indeterminate state is
through code. If IsThreeState is True, clicking the check box cycles through all three possible
states.
The ToggleButton class also defines three events that fire when the check box enters specific
states: Checked, Unchecked, and Indeterminate. In most cases, it??™s easier to consolidate
this logic into one event handler by handling the Click event that??™s inherited from ButtonBase.
The Click event fires whenever the button changes state.
CHAPTER 7 n CLASSIC CONTROLS 197
The RadioButton
The RadioButton also derives from ToggleButton and uses the same IsChecked property and
the same Checked, Unchecked, and Indeterminate events. Along with these, the RadioButton
adds a single property named GroupName, which allows you to control how radio buttons are
placed into groups.
Ordinarily, radio buttons are grouped by their container. That means if you place three
RadioButton controls in a single StackPanel, they form a group from which you can select just
one of the three. On the other hand, if you place a combination of radio buttons in two separate
StackPanel controls, you have two independent groups on your hands.
The GroupName property allows you to override this behavior.
Pages:
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386