WPF
Declarative desktop UI with XAML.
WPF is taught here in 14 lessons, running from XAML and layout panels through to WPF performance and testing MVVM applications. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.
| Track | .NET |
| Lessons | 14 |
| Level | Beginner to intermediate |
| Reading time | about 3 hours |
| Prerequisites | Helpful, but not required: WinForms |
Lessons
- XAML and layout panelsHow XAML maps to objects, the layout panels worth knowing, and the sizing rules that make a window resize gracefully.
- Data bindingDataContext, binding modes and update triggers, change notification, and converters that keep formatting out of the view model.
- MVVM basics and commandsThe view-model pattern, ICommand and a reusable RelayCommand, and where commands stop being enough.
- What WPF is and how a project is structuredWPF on modern .NET versus .NET Framework, App.xaml and startup, the visual tree, and a project layout that keeps XAML and logic apart.
- Dependency properties and routed eventsWhy dependency properties exist, how to register one correctly, attached properties, and how bubbling and tunnelling events actually reach your handler.
- Resources, styles, templates and themesResource lookup order, implicit and explicit styles, control and data templates, triggers, and merged theme dictionaries that keep a design consistent.
- Items controls, collections and virtualizationListBox, ListView, DataGrid and ItemsControl, item containers and templates, grouping and sorting with CollectionViewSource, and the virtualization settings that decide whether a list stays smooth.
- Validation, converters and input handlingValidation rules, IDataErrorInfo and INotifyDataErrorInfo, when a converter beats a string format, and the canExecute and focus details that make a form feel finished.
- Navigation, windows and dialogsModal windows with ownership and results, a navigation service that a view model can use without referencing WPF, frame and tab navigation, and window lifetime rules.
- Asynchronous work and UI responsivenessawait on the dispatcher, Task.Run for CPU work, progress and cancellation, dispatcher priorities, and how to keep a window from freezing.
- Custom controls and user controlsUserControl versus templated Control, control parts and states, dependency properties for reusable controls, and when composition beats templating.
- Animation and visual statesStoryboards and property animation, easing, triggers and VisualStateManager, transitions, and how to respect a user who asked for less motion.
- 2D graphics, shapes and transformsShapes versus drawings, Geometry and Path, brushes and gradients, render transforms, and rendering a visual to a bitmap offscreen.
- WPF performance and testing MVVM applicationsBinding and layout cost, virtualization and frozen resources, profiling the UI thread, testing view models without a window, and when UI automation earns its cost.
More in .NET
.NET ASP.NET Core LINQ WinForms
FAQ
How long does the WPF course take?
It has 14 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for WPF?
Not strictly. It helps to have read WinForms first, because some lessons build on it, but every lesson explains its own assumptions.
What should I read after WPF?
This is the last course in .NET right now. Browse the other tracks from the courses index to go sideways.