The WPF Control Toolbox
WPF ships with a rich set of built-in controls — Button, TextBox, CheckBox, RadioButton, ListBox, ComboBox, ListView, TreeView, Slider, ProgressBar and more — all deriving ultimately from Control, which itself derives from FrameworkElement. Unlike WinForms controls that draw themselves with GDI+, every WPF control is 'lookless': its visual appearance is defined entirely by a Template, so the same Button class can look like a flat Fluent-style button or a rounded skeuomorphic one without subclassing anything.
Cricket analogy: Just as the LBW rule is a single fixed law applied identically whether the match is a Test at Lord's or a T20 at the Wankhede, the Button class has one behavioural contract but its visual rendering (the template) can be swapped per app.
Buttons, TextBoxes and Toggle Controls
Button, RepeatButton and ToggleButton form a family under ButtonBase, all exposing a Click event (ToggleButton adds Checked/Unchecked) and a Command property for MVVM binding. TextBox is a plain-text editor supporting properties like AcceptsReturn, MaxLength and TextWrapping, while PasswordBox deliberately withholds a Text-bindable property for security reasons — you must go through the code-behind or a behavior to read its value. CheckBox and RadioButton both derive from ToggleButton, differing only in their default template and the fact that RadioButtons in the same GroupName container are mutually exclusive.
Cricket analogy: A RadioButton group behaves like choosing the toss decision — bat or bowl — you can only pick one option per match, just as RadioButtons sharing a GroupName allow only a single selection at a time.
Items Controls: ListBox, ComboBox and ItemsControl
ItemsControl is the base class for anything that displays a collection: ListBox, ComboBox, ListView and TreeView all inherit its ItemsSource, DisplayMemberPath and ItemTemplate properties. Setting ItemsSource to an ObservableCollection<T> means the UI automatically reflects Add/Remove operations because ObservableCollection raises CollectionChanged notifications that ItemsControl subscribes to internally. ListBox additionally supports SelectionMode (Single, Multiple, Extended) via its Selector base class, while ComboBox adds a drop-down popup and an IsEditable property for free-text entry combined with a predefined list.
Cricket analogy: An ObservableCollection<T> bound to a ListBox is like a live scorecard app that auto-refreshes every run and wicket the instant the umpire signals, without anyone manually reloading the page.
<StackPanel Margin="12">
<TextBlock Text="Choose a difficulty:" Margin="0,0,0,4"/>
<ComboBox x:Name="DifficultyCombo"
ItemsSource="{Binding Difficulties}"
SelectedItem="{Binding SelectedDifficulty}"
DisplayMemberPath="Name"
Width="180" HorizontalAlignment="Left"/>
<CheckBox Content="Enable hardcore mode" Margin="0,8,0,0"
IsChecked="{Binding HardcoreMode}"/>
<ListBox ItemsSource="{Binding Players}"
SelectionMode="Extended"
DisplayMemberPath="PlayerName"
Height="120" Margin="0,8,0,0"/>
<Button Content="Start Match" Command="{Binding StartMatchCommand}"
Margin="0,12,0,0" Width="120" HorizontalAlignment="Left"/>
</StackPanel>Almost every WPF control's default appearance comes from the current theme's generic.xaml (or Aero2/Fluent resource dictionaries). You rarely need to build a ControlTemplate from scratch just to restyle colors — a Style with Setters is usually enough; reach for a full ControlTemplate only when the structural layout itself must change.
PasswordBox.Password is intentionally not bindable in standard WPF binding because storing plaintext passwords in a bound view-model property is a security anti-pattern. Use a PasswordBoxHelper attached-behavior or handle it in code-behind, and never log or serialize the value.
- All WPF controls derive from Control and are 'lookless' — behavior and appearance are separated via templates.
- ButtonBase (Button, ToggleButton, RepeatButton) exposes Click/Checked events and supports Command binding for MVVM.
- PasswordBox deliberately does not expose a bindable Text-like property for security reasons.
- RadioButtons sharing the same GroupName are mutually exclusive within that group only.
- ItemsControl is the common base for ListBox, ComboBox, ListView and TreeView, driven by ItemsSource and ItemTemplate.
- ObservableCollection<T> keeps bound ItemsControls in sync automatically via CollectionChanged notifications.
- ComboBox's IsEditable property allows free-text entry alongside a predefined item list.
Practice what you learned
1. Which base class do Button, ToggleButton and RepeatButton all derive from?
2. Why doesn't PasswordBox support standard {Binding} on a Password-equivalent Text property?
3. What must you set on RadioButtons for them to be mutually exclusive as a set?
4. Which property lets a ComboBox accept free-text input in addition to its predefined list?
5. What automatically keeps an ItemsControl in sync when items are added to its bound collection?
Was this page helpful?
You May Also Like
Data Templates
How DataTemplate lets WPF turn plain view-model objects into rich, reusable visual trees — the backbone of MVVM-driven UIs.
Control Templates
How ControlTemplate redefines a control's entire visual structure while preserving its behavior, using TemplateBinding and named parts.
Styles in WPF
How Style resources centralize and reuse property Setters across controls, including implicit styles, BasedOn inheritance, and Style-level triggers.
Related Reading
Related Study Notes in Microsoft Technologies
Browse all study notesWindows 10 / UWP Development Study Notes
.NET · 30 topics
Microsoft TechnologiesWindows Batch Scripting Study Notes
Batch · 30 topics
Microsoft TechnologiesMFC (Microsoft Foundation Classes) Study Notes
C++ · 30 topics
Microsoft TechnologiesSilverlight Study Notes
.NET · 30 topics
Microsoft TechnologiesXAML Study Notes
.NET · 30 topics
Microsoft TechnologiesMVVM Design Pattern Study Notes
.NET · 30 topics