.NET MAUI › Data Binding & MVVM

What are compiled bindings and why use them?

Advanced

Answer

Compiled bindings (x:DataType on a view) resolve binding paths at compile time instead of via reflection at runtime. They give compile-time error checking, better performance, and IntelliSense. Set x:DataType to the view-model type; MAUI generates efficient get/set code. They're recommended for all production bindings.
<ContentPage xmlns:vm="clr-namespace:MyApp.ViewModels"
             x:DataType="vm:MainViewModel">
    <Label Text="{Binding Title}" />
</ContentPage>
Real-world example Enabling compiled bindings surfaces a typo in a binding path as a build error instead of a silent blank label at runtime.

Common follow-ups: How do compiled bindings improve performance? | What happens if the path is wrong?