WPF (.NET 10) · Interview questions · Updated November 2026
WPF interview questions test how well you understand Windows Presentation Foundation on current .NET: dependency properties, routed events, data binding, MVVM, styles and templates, threading and performance. Microsoft describes WPF as a resolution-independent, vector-based UI framework that runs only on Windows; prepare for .NET 10, the current long-term support release. This guide sets out the topics by level and a 2–3 week plan, then gives you 10 free WPF practice questions with answers and explanations.
At a glance
| Topic | Windows Presentation Foundation (WPF) |
| Runs on | Windows only, on .NET or .NET Framework 4 |
| Current LTS | .NET 10 (LTS, supported to 14 November 2028) |
| Levels covered | Junior, mid-level and senior |
| Core topics | XAML, binding, MVVM, routed events, templates, threading |
| Exametics set | 6 practice tests, 648 questions |
- .NET 8 and .NET 9 both reach end of support on 10 November 2026, so expect questions framed around .NET 10.
Source: Microsoft Learn: What is WPF and .NET support policy. Checked on 9 November 2026.
What WPF interview questions test, topic by topic
WPF interview questions test the systems underneath the controls: the property system, the event system, the binding engine and the UI thread. Interviewers rarely stop at definitions; they ask why a value did not update or why an event never fired.
| Topic area | A typical interview question |
|---|---|
| Dependency properties | Why is the logic in my property wrapper skipped when the property is bound? |
| Routed events | In what order do PreviewMouseDown and MouseDown run, and what does Handled = true stop? |
| Data binding and MVVM | Why does my list not show items added at run time? |
| Resources and templates | When do you need DynamicResource instead of StaticResource? |
| Threading and performance | Why does setting a TextBlock from Task.Run throw, and how do you fix it? |
XAML, layout and the property system
Start with XAML and layout. Know how x:Class and InitializeComponent join markup to code-behind, and how panels such as Grid, StackPanel, DockPanel and WrapPanel arrange children. The What’s new in WPF for .NET 10 page adds a short form for Grid rows and columns, such as ColumnDefinitions="1*, 2*, Auto".
Dependency properties are a core deep topic. The dependency properties overview says the identifier field is always the property name plus the suffix Property, and that styles, data binding, animation, metadata overrides and value inheritance all rely on dependency properties.
- Registration: a
public static readonly DependencyPropertyfield fromDependencyProperty.Register, plus a CLR wrapper that only callsGetValueandSetValue. - Value precedence: the value precedence list puts coercion first, then active animations, then local values, all above style triggers and style setters.
Routed events and commands
Routed events are the second deep topic. The routed events overview names three strategies: bubbling, tunnelling (the Preview events) and direct. Know e.Source versus sender, what Handled = true does, and how handledEventsToo still receives a handled event.
Commands come next. The commanding overview describes four parts: the command, the command source, the command target and the command binding. A command reports whether it can run through CanExecute.
Data binding and MVVM
Expect binding questions. The data binding overview covers the four modes (OneWay, TwoWay, OneWayToSource, OneTime), INotifyPropertyChanged, ObservableCollection<T>, value converters and validation rules.
For MVVM, know the MVVM Toolkit (CommunityToolkit.Mvvm, part of the .NET Community Toolkit): ObservableObject, the [ObservableProperty] and [RelayCommand] source generators, and why the class must be partial.
Styles, templates, resources and custom controls
Expect ControlTemplate versus DataTemplate questions. The XAML resources overview explains that a StaticResource is resolved at load time and cannot reference a resource defined later, while a DynamicResource is evaluated at run time and follows theme and system changes.
The control authoring overview says consumers cannot re-template a UserControl; for a control that supports templates and themes you derive from Control and put its default style in Themes/generic.xaml.
The What’s new in WPF for .NET 9 page introduced the Fluent theme and the ThemeMode property, with the values Light, Dark, System and None. The .NET 9 page marks setting ThemeMode in code as experimental (diagnostic WPF0001).
Threading, performance and interop
The WPF threading model says a DispatcherObject is tied to the thread that created it. Background threads hand UI work to the Dispatcher; only Invoke waits for the UI thread to finish it.
The control performance guide lists what silently turns off UI virtualization, such as setting CanContentScroll to false. For interop, the WPF and Windows Forms interop page covers WindowsFormsHost and ElementHost, and notes that a hosted Windows Forms control always draws on top of WPF elements.
Exametics practice tests
WPF Interview Questions Practice Tests
- 6 practice tests with 108 questions each: 648 questions in total
- Rebuilt in November 2026 against the current Microsoft Learn WPF documentation for .NET 10
- Every answer explained, with a hint, and tagged with one of fifteen topic areas
- Timed Exam Mode test, plus new questions on custom controls, animation, interop, the Fluent theme and CommunityToolkit.Mvvm
- Lifetime access
30-day refund. Instant access after payment.
WPF interview questions by level: junior, mid and senior
The level of the role changes the depth more than the topics: juniors explain what a feature does, mid-level developers explain why code behaves as it does, and seniors explain how they would design, extend and speed up an app.
| Level | What you should be able to do |
|---|---|
| Junior | Build a window in XAML with layout panels, bind controls to a view model, use INotifyPropertyChanged and ObservableCollection<T>, and write a simple style. |
| Mid-level | Debug bindings, write value converters and validation, use commands and CommunityToolkit.Mvvm, choose between StaticResource and DynamicResource, and move work off the UI thread. |
| Senior | Author templatable custom controls with dependency properties and routed events, reason about value precedence, tune virtualization, plan interop with Windows Forms and plan a move from .NET Framework to .NET 10. |
From mid-level up, expect “why does this not work?” questions: a missing change notification, a binding that updates on lost focus, or a background thread touching a control. Senior rounds add design: why a local value beats a style trigger, or how to keep a 50,000-row list responsive.
Next on your .NET path
- ADO.NET Interview Questions practice tests: WPF apps that talk to SQL Server can use ADO.NET for data access.
- WCF (Windows Communication Foundation) practice tests: useful for roles that maintain older WPF apps calling WCF services.
- ASP.NET Core MVC practice tests: useful if the role covers both a desktop client and a web back end on .NET.
For background reading, see our guides to ADO.NET interview questions on connections and data readers, WCF interview questions for .NET developers and ASP.NET Core MVC practice tests on routing, controllers and Razor.
How to prepare for a WPF interview in 2–3 weeks
If you already build desktop apps in C#, two to three weeks is a realistic plan.
- Days 1–3: XAML, layout and dependency properties Create a .NET 10 WPF app, lay it out with
GridandDockPanel, and write one custom dependency property with a coerce callback. Set it locally, from a style and from a trigger, and explain which value wins. - Days 4–6: routed events and commands Log
PreviewMouseDownandMouseDownhandlers at three levels, mark one handled, then add aCommandBindingand aKeyBinding. - Days 7–10: data binding and MVVM Build a master-detail screen with
ObservableCollection<T>, a value converter and a validation rule. Rewrite the view model with[ObservableProperty]and[RelayCommand]from CommunityToolkit.Mvvm. - Days 11–13: styles, templates, threading and performance Re-template a button, build a custom control with
Themes/generic.xaml, tryThemeMode="System"and bind aListBoxto 50,000 items. - Days 14–18: timed practice Take the WPF interview practice tests in timed Exam Mode, read the explanation for every question you missed, and repeat the topic areas where you scored lowest.
Planning more than one exam?
If you are preparing for several interviews or certifications, the All-Access Pass covers every practice test on Exametics, including the 58 interview-question sets and new exams as they are added, with lifetime access. It costs less than buying about six single practice tests.
Free WPF interview questions (10 with answers)
Try these 10 free WPF practice questions before you open the answers, like a short practice test. They are original sample questions written for WPF on .NET 10, each labelled with its topic area; the full Exametics WPF practice tests have 648 questions in the same style.
Practice question 1 · Dependency properties
A custom control registers MaxItemsProperty with DependencyProperty.Register. Its CLR wrapper’s set accessor clamps the value to 100 before calling SetValue. When MaxItems is set through a {Binding}, values above 100 are not clamped. Why, and what is the fix?
- A. Bindings only work on CLR properties that raise
PropertyChanged, so the binding writes to a hidden field instead. - B. The identifier field must be called
MaxItems, without thePropertysuffix, for the wrapper to be used. - C. WPF sets the value through the property system directly, so the wrapper’s
setaccessor is bypassed; move the clamping into aCoerceValueCallback. - D. A dependency property can only be bound with
Mode=TwoWay; any other mode skips the wrapper.
Show answer
Answer: C. Microsoft’s control authoring overview says clients and WPF can bypass the wrapper and call GetValue and SetValue directly, and that when a property is bound to a data source its set accessor is not called.
A is wrong because INotifyPropertyChanged is needed on the binding source, not the target. B reverses the naming convention. D is wrong because a dependency property can be the target of any binding mode.
Practice question 2 · Property value precedence
A Border in an order list has BorderBrush="Green" set in its XAML and Style="{StaticResource CardBorder}". That style sets BorderBrush to Gray with a setter, and a DataTrigger sets it to Orange when the bound order’s IsOverdue is true. Which border colour does an overdue order show?
- A. Green, for overdue and other orders alike.
- B. Orange for overdue orders and green otherwise, because triggers are evaluated last.
- C. Gray, because a style setter overrides a value set in markup.
- D. Orange for every order, because a
DataTriggervalue is stored as a local value.
Show answer
Answer: A. An attribute set on the element is a local value. In the dependency property value precedence list, local values rank above style triggers and style setters; only coercion and active animations rank higher. To let the trigger win, move Green into a style setter.
B is wrong because a style trigger cannot beat a local value. C reverses the order. D is wrong because trigger values are not local values.
Practice question 3 · Routed events
A Window contains a Border, which contains an Ellipse. The ellipse is filled, and all three have handlers for PreviewMouseDown and MouseDown, and no handler sets Handled. The user presses the mouse on the ellipse. In what order do the handlers run?
- A. Ellipse
PreviewMouseDown, EllipseMouseDown, BorderPreviewMouseDown, BorderMouseDown, WindowPreviewMouseDown, WindowMouseDown. - B. Window
MouseDown, BorderMouseDown, EllipseMouseDown, then the threePreviewMouseDownhandlers from the ellipse upwards. - C. Only the ellipse’s two handlers run, because mouse events use the direct routing strategy.
- D. Window, Border, Ellipse
PreviewMouseDown; then Ellipse, Border, WindowMouseDown.
Show answer
Answer: D. WPF input events come in preview and bubbling pairs. The routed events overview says the preview event is raised first and completes its route, tunnelling from the root to the source; then the bubbling event is raised and travels from the source back up to the root.
A interleaves the two events per element. B reverses both directions. C is wrong because MouseDown and PreviewMouseDown are routed (bubbling and tunnelling), not direct events.
Practice question 4 · Data binding
A TextBox uses Text="{Binding SearchTerm}". The view model implements INotifyPropertyChanged, but its SearchTerm setter only runs when the user tabs out of the box. The product owner wants live filtering as the user types. What is the smallest correct change?
- A. Set
Mode=OneWayToSourceon the binding. - B. Set
UpdateSourceTrigger=PropertyChangedon the binding. - C. Raise
PropertyChangedforSearchTermin the view model constructor. - D. Set
Mode=OneTimeso the value is pushed straight away.
Show answer
Answer: B. Microsoft’s data binding overview says most dependency properties update their source on PropertyChanged, but TextBox.Text defaults to LostFocus, so the source changes only when the box loses focus. Setting UpdateSourceTrigger=PropertyChanged pushes every keystroke to the view model.
A changes the direction, not the timing, and stops source changes reaching the box. C affects source-to-target updates, not when the box writes back. D is wrong because OneTime only initialises the target once and never updates the source.
Practice question 5 · Collections and binding
A view model exposes public List<Order> Orders { get; }, and a ListView binds ItemsSource to it. Orders that exist at start-up appear, but orders added later with Orders.Add(order) never appear. Which change fixes this with the least code?
- A. Call
UpdateLayout()on theListViewafter everyAdd. - B. Set
Mode=TwoWayon theItemsSourcebinding. - C. Change the property type to
ObservableCollection<Order>. - D. Set
UpdateSourceTrigger=PropertyChangedon theItemsSourcebinding.
Show answer
Answer: C. The data binding overview says a collection must implement INotifyCollectionChanged for insertions and deletions to update the UI, and that ObservableCollection<T> is WPF’s built-in implementation. List<T> raises no such event.
A only re-runs layout; the ListView still does not know the list grew. B and D control how values flow back to the source, which is not the problem here.
Practice question 6 · Threading and the Dispatcher
Code inside Task.Run(...) finishes a long calculation and then sets StatusText.Text = "Done", where StatusText is a TextBlock created in XAML. The line throws an exception. Which change is correct?
- A. Hand the update to the UI thread, for example
StatusText.Dispatcher.InvokeAsync(() => StatusText.Text = "Done"). - B. Call
StatusText.VerifyAccess()before setting the text, so access is granted to the background thread. - C. Wrap the assignment in a
lockstatement so only one thread changes the text at a time. - D. Create a new
TextBlockon the background thread and copy its text intoStatusText.
Show answer
Answer: A. The WPF threading model page says a DispatcherObject is tied to the thread that created it, and a background thread asks the UI thread to do work by registering it with the UI thread’s Dispatcher through InvokeAsync, BeginInvoke or Invoke.
B is wrong because VerifyAccess only checks the thread and throws when it does not match; it grants nothing. C is wrong because the problem is thread affinity, not a race. D still sets StatusText from the background thread, so it fails the same way.
Practice question 7 · Resources and themes
A TextBlock sets Foreground="{StaticResource {x:Static SystemColors.AccentColorBrushKey}}". While the app is running, the user changes the Windows accent colour, but the text keeps the old colour until the app restarts. What should the developer change?
- A. Set
ThemeMode="System"on the window. - B. Move the resource reference into
App.xamlso it is looked up at application level. - C. Use
{x:Static SystemColors.AccentColorBrush}instead of the resource key. - D. Change the reference to
{DynamicResource {x:Static SystemColors.AccentColorBrushKey}}.
Show answer
Answer: D. The XAML resources overview says a static resource is looked up once during load, while a dynamic resource is an expression evaluated at run time and is the right choice for system values that can change. Microsoft’s .NET 9 WPF page gives the same advice for accent colours.
A only chooses the light or dark Fluent theme. B still makes a one-time static lookup. C reads the brush once at load, so it also misses later changes.
Practice question 8 · Custom controls
You are writing a RatingControl for a shared control library. Other teams must be able to replace its whole look with their own ControlTemplate while keeping its behaviour. Which approach fits?
- A. Derive from
UserControl, build the stars in its XAML file and expose colour properties. - B. Derive from
Control, put the default style and template inThemes/generic.xaml, and overrideDefaultStyleKeyPropertymetadata in a static constructor. - C. Derive from
FrameworkElementand draw the stars inOnRender. - D. Derive from
Paneland overrideMeasureOverrideandArrangeOverride.
Show answer
Answer: B. Microsoft’s control authoring overview says to derive from Control when a control must support templates and themes, so users can redefine its ControlTemplate. The default style lives in Themes/generic.xaml, found through the DefaultStyleKey override.
A is wrong because the same page says users of a UserControl cannot use a ControlTemplate or DataTemplate to change its look. C is for appearance drawn by custom rendering logic, not templates. D builds a layout panel, not a templatable control.
Practice question 9 · MVVM and CommunityToolkit.Mvvm
A partial view model that derives from ObservableObject contains [RelayCommand] private async Task LoadOrdersAsync(CancellationToken token). Which statement about the generated command is correct with default settings?
- A. It is a
RelayCommandproperty calledLoadOrdersAsyncCommand, and the token is passed as the command parameter. - B. It is an
IRelayCommand<CancellationToken>property calledOnLoadOrdersCommand. - C. It is an
IAsyncRelayCommandproperty calledLoadOrdersCommand, and it reports itself as unable to execute while a run is pending. - D. It is an
IAsyncRelayCommandproperty calledLoadOrdersCommand, and it stays enabled and queues every extra click as a concurrent run.
Show answer
Answer: C. The RelayCommand generator docs say the command name is the method name plus Command, with an Async suffix stripped, and that a method returning Task becomes an IAsyncRelayCommand. A CancellationToken parameter is wired to the command’s cancellation rather than becoming a command parameter. AllowConcurrentExecutions defaults to false, so the command signals that it is disabled while a run is pending.
A gets the name and type wrong. B is wrong because an On prefix is stripped, never added. D describes AllowConcurrentExecutions = true, which is not the default.
Practice question 10 · Performance
A data-bound ListBox with 50,000 items opened quickly. A developer then set ScrollViewer.CanContentScroll="False" to get pixel-based scrolling, and now the window takes seconds to open and uses far more memory. What is the most likely cause?
- A. Container recycling turned itself off, so containers are destroyed and re-created on every scroll.
- B. Setting
CanContentScrolltofalsedisables UI virtualization, so WPF creates and lays out a container for every item. - C. WPF’s built-in data virtualization was disabled, so all 50,000 data objects are now loaded into memory.
- D. Deferred scrolling was switched on, so the content is redrawn only after the thumb is released.
Show answer
Answer: B. Microsoft’s control performance guide says UI virtualization is on by default for a data-bound ListBox or ListView, and lists setting CanContentScroll to false as one of the conditions that disable it. Without virtualization, a container is generated and measured for each item, not just the visible ones.
A is wrong because recycling is opt-in with VirtualizationMode="Recycling" and affects scrolling, not opening. C is wrong because the guide says no WPF control has built-in data virtualization. D only changes when scrolling redraws and is not turned on by this setting.
How did you score?
8–10 correct: you are ready for a full timed test, so try Exam Mode next. Under 8: reread the Microsoft Learn page for the topic areas you missed, rebuild the example in a small app, then practise again. The WPF interview practice tests have 648 questions like these, each with a hint and a full explanation.
Common mistakes in WPF interviews
Answers often fall short when they name a feature without explaining how WPF decides what happens.
- Putting logic in a dependency property wrapper. Bindings, styles and animations bypass it. Use coerce, validate or property-changed callbacks.
- Using
List<T>for bound collections. Lists that change at run time needObservableCollection<T>or anotherINotifyCollectionChangedcollection. - Forgetting the
TextBox.Textdefault. It updates its source on lost focus unless you setUpdateSourceTrigger=PropertyChanged. - Updating controls from a background thread. Hand the work to the
Dispatcher, or await the task and update afterwards on the UI thread. - Using
StaticResourcefor values that change. Theme and system values such as the accent colour needDynamicResource.
WPF interview questions: FAQs
What do WPF interview questions cover in 2026?
They cover XAML and layout, dependency properties, routed events, data binding, commands and MVVM, styles and templates, resources, threading and performance. Newer topics include the Fluent theme from .NET 9 and the CommunityToolkit.Mvvm source generators.
Are there free WPF interview practice questions?
Yes. This post includes 10 free WPF practice questions written for .NET 10, each with the answer and an explanation. For full timed practice, the Exametics WPF interview practice tests have 6 tests with 108 questions each, 648 questions in total.
How many questions are in the Exametics WPF interview practice tests?
There are 6 practice tests with 108 questions each, 648 questions in total, including a timed Exam Mode test. Every question explains why the right answer is right and why the others are wrong, includes a hint and is tagged with one of fifteen topic areas.
Is WPF still worth learning in 2026?
Microsoft updated WPF again in .NET 10: the What’s new in WPF for .NET 10 page lists performance work, more Fluent styles and new APIs. WPF runs only on Windows, so it fits roles that build or maintain Windows desktop applications.
Which .NET version should I prepare for in a WPF interview?
Prepare for .NET 10. The .NET support policy lists .NET 10 as a long-term support release supported until 14 November 2028, while .NET 8 and .NET 9 reach end of support on 10 November 2026.
Are WPF interviews hard, and how long does it take to prepare?
They are hardest where interviewers ask why code behaves as it does: value precedence, routed event order and threading. If you already write C# desktop code, two to three weeks of focused study is a realistic plan; allow more time if you are new to XAML.
Official documentation: Windows Presentation Foundation for .NET documentation. Checked on 9 November 2026.
Practise WPF interview questions for .NET 10
Work through 648 WPF questions in six practice tests, rebuilt in November 2026 for .NET 10, with a hint and a full explanation for every answer.
✓ Every answer explained · ✓ Timed exam mode · ✓ 30-day refund