← All lessons

Level 1 / XAML + MVVM / lesson 2 of 6

When a binding silently fails

Recognise and fix binding paths that do not resolve.

A misspelled binding path is not a compile error. In a real app the control simply renders empty and a warning goes to the debug output, which is why this is the single most common way to lose an afternoon. Both bindings below are wrong.

Understand the idea

A binding can fail at runtime

Misspelling StationName as StationNmae leaves the control without the expected value. XAML can still load, so inspect the framework's binding diagnostics instead of assuming the view model is empty.

Names and context both matter

A correctly spelled property still fails if the view has the wrong DataContext or BindingContext. Check the object assigned as context, then the path and its capitalization.

Nested paths depend on types

StationName.Length reads a member of the string returned by StationName. Longer paths add more places where a null value or missing member can break the display.

7 lines
5 lines

Preview - simulated. Not a .NET compiler.

Binding error: MainViewModel has no property "StationNmae".Binding error: MainViewModel has no property "Crew".

Outside this lesson

  • line 2: Binding error on Text: There is no "StationNmae" in scope.
  • line 3: Binding error on Text: There is no "Crew" in scope.

Step 1 of 3

In progress

Fix the typo

The first binding says StationNmae. Correct it to match the property on the view model.

  • A TextBlock binds Text to StationName - not done yet
  • The preview shows Ada Helibase - 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 flags unsupported and missing paths visibly. Actual WPF binding failures are commonly diagnosed in the IDE output window; behavior differs by UI framework and binding mode.

Try it in a real .NET project

In a WPF window, bind one TextBlock to a misspelled property, run it, and inspect Visual Studio's Output window for a binding error. Correct the path, then deliberately swap the DataContext to see how that failure differs.

Check your understanding

The path looks right, but the TextBlock is blank. What two things should you check first?

Show the explanation

Check which object is assigned as the binding context, then check that the path matches a public property on that object exactly, including capitalization.

Goose School teaches Microsoft's stack. Goose Solutions is not affiliated with, endorsed by, or sponsored by Microsoft.