Level 1 / XAML + MVVM / lesson 5 of 6
Why the screen did not update
This view model uses a plain auto property. The command really does change it - and the screen never moves, because nothing raises `PropertyChanged`. This is the bug everyone writes once. Here you get to watch it happen on purpose.
Understand the idea
A changed field is not a changed screen
A plain auto property can hold a new value without telling the binding system. The preview deliberately keeps showing the old value so you can observe the missing notification.
INotifyPropertyChanged is a contract
Implement the PropertyChanged event and raise it when a property value changes. SetProperty is a common helper, not a method built into C# or INotifyPropertyChanged.
Prove both sides
Test that the command changes the underlying value and that the view refreshes. If only the first succeeds, the likely issue is notification, context, or a binding path.
Preview - simulated. Not a .NET compiler.
Step 1 of 3
In progressWire up the button
Add a Button bound to IncrementCommand, press it a few times, and read the warning the preview gives you.
- A Button binds Command to IncrementCommand - not done yet
Coach
The checklist above is what decides whether a step is done. The coach only explains; it never grades.
The preview is a simulated XAML surface, not WPF, WinUI, or .NET MAUI. It renders StackPanel, Grid, TextBlock, Label, TextBox, Entry, and Button, and simulates INotifyPropertyChanged and ICommand. Layout attributes such as Margin and Width are accepted but not laid out. Anything else is reported as outside the lesson.
Where the simulator stops
The simulator recognizes a SetProperty pattern but does not define that helper in the editor. In a real project, supply an implementation or use a view-model base class from a toolkit.
Try it in a real .NET project
In a WPF view model, implement INotifyPropertyChanged or inherit from ObservableObject. Start with an auto property that stays stale after a command, then replace it with a notifying property and confirm the TextBlock updates.
Check your understanding
A command increments Count in the view model, but the visible number stays the same. What is missing?
Show the explanation
The bound property did not raise PropertyChanged, so the view was never told to read Count again. Use a notifying setter and verify the context and binding path too.
Goose School teaches Microsoft's stack. Goose Solutions is not affiliated with, endorsed by, or sponsored by Microsoft.