Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Phone

The App Bar and Controls - The Button Hierarchy

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/17/2011 4:40:36 PM
This class hierarchy is complete beginning with the ButtonBase class:
Control (abstract)
ContentControl
ButtonBase (abstract)
Button
HyperlinkButton
RepeatButton (sealed)
ToggleButton
CheckBox
RadioButton

It’s actually ButtonBase that defines the Click event and the ClickMode property.

The ButtonCornucopia project creates instances of all these buttons with nearly as few superfluous properties as possible:

Example 1. Silverlight Project: ButtonCornucopia File: MainPage.xaml
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<StackPanel>
<Button Content="Button" HorizontalAlignment="Center" />
<HyperlinkButton Content="HyperlinkButton" HorizontalAlignment="Center" />
<RepeatButton Content="RepeatButton" HorizontalAlignment="Center" />
<ToggleButton Content="ToggleButton" HorizontalAlignment="Center" />
<CheckBox Content="CheckBox" HorizontalAlignment="Center" />

<Border BorderBrush="White"
BorderThickness="1"
HorizontalAlignment="Center">
<StackPanel>
<RadioButton Content="RadioButton1" />
<RadioButton Content="RadioButton2" />
<RadioButton Content="RadioButton3" />
</StackPanel>
</Border>
</StackPanel>
</Grid>


The buttons may seem a bit large with too much space around them, but keep in mind that they need to provide adequate touch targets:



The HyperlinkButton is used in connection with Silverlight page navigation, and includes a NavigateUri property for that purpose. RepeatButton generates multiple Click events when the button is held down; its primary purpose is in the ScrollBar and Slider, and it’s rarely used elsewhere.

There is no functional difference between the ToggleButton and CheckBox. The difference is only visual, and that’s something that can be changed with a template. The Silverlight for Windows Phone Toolkit adds a ToggleButton derivative named ToggleSwitchButton that you’ve probably seen in the Settings section of a Windows Phone.

When checked, the RadioButton causes all its siblings to become unchecked. There is no special container for the RadioButton. Just put two or more in a panel (almost always a StackPanel) and they will turn off by themselves. RadioButton defines a GroupName property that allows you to differentiate multiple groups of mutually exclusive buttons that might be children of the same panel.

Normally the ToggleButton and CheckBox are physical manifestations of a Boolean. They turn on and off with successive clicks. But ToggleButton defines an IsThreeState property that optionally provides a third “indeterminate” state. Generally this is used only in connection with the CheckBox; the ToggleButton doesn’t even have a unique visual appearance for the indeterminate state.

Consequently, the IsChecked property defined by ToggleButton is not of type bool. It’s of type Nullable<bool> (also written as bool?) with three possible values: true, false, and null. If you need to set the IsChecked property to a null value in XAML you can use a special markup extension:

IsChecked="{x:Null}"

For conventional two-state toggling purposes, IsChecked usually needs to be cast to bool.

ToggleButton defines three events: Checked is fired when the button becomes checked, Unchecked when it becomes unchecked, and Indeterminate when it’s going into the third state. In most cases, a program using a ToggleButton or CheckBox needs to handle both the Checked and Unchecked events, but you can use the same handler for both events.

Other -----------------
- The App Bar and Controls - Theme Styles and Precedence
- The App Bar and Controls - The Concept of Content
- The App Bar and Controls - The Basic Button
- The App Bar and Controls - RangeBase and Slider
- The App Bar and Controls - Elements and Controls
- The App Bar and Controls - Jot and the ApplicationBar
- The App Bar and Controls - Jot and Touch
- The App Bar and Controls - Jot and Application Settings
- The App Bar and Controls - ApplicationBar Icons
- Issues in Application Architecture - Xna Tombstoning and Settings
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server