maui-data-binding

Guide .NET MAUI XAML data bindings with compiled bindings and x:DataType placement.

Updated Nov 27, 2025
One-click install
npx skills add https://github.com/seydakaratekeli/KamPay3 --skill maui-data-binding-seydakaratekeli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maui-data-binding
Source: https://github.com/seydakaratekeli/KamPay3/tree/main/KamPay/.github/skills/maui-data-binding%20-%20Kopyala
Command: npx skills add https://github.com/seydakaratekeli/KamPay3 --skill maui-data-binding-seydakaratekeli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps developers avoid common XAML data binding mistakes, eliminate reflection-based bindings, and improve runtime and AOT performance by guiding correct usage of binding modes, compiled bindings, converters, and MVVM patterns.

Core Features & Use Cases

  • Guidance on binding modes: when to omit or explicitly set Mode to reduce noise and bugs.
  • Compiled bindings & x:DataType placement: where to declare x:DataType for compile-time checking and AOT/trimmer safety.
  • Converters, multi-binding, and threading: patterns for IValueConverter/IMultiValueConverter, safe ObservableCollection updates, and UI thread marshaling.
  • Use Case: Audit a MAUI XAML page and DataTemplate to convert reflection bindings to compiled bindings, add appropriate converters, and ensure ObservableCollection modifications are thread-safe for an AOT build.

Quick Start

Use the maui-data-binding skill to review a XAML file and recommend x:DataType placement, binding mode fixes, and converter or threading improvements.

Frequently Asked Questions about maui-data-binding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use compiled bindings in .NET MAUI XAML to improve performance?

Compiled bindings in .NET MAUI are enabled by declaring x:DataType on your XAML page or DataTemplate, which provides compile-time checking and eliminates reflection-based overhead for better runtime and AOT performance.

What is the correct x:DataType placement for MAUI DataTemplates and CollectionViews?

For MAUI DataTemplates and CollectionViews, x:DataType placement should be on the root element of the DataTemplate itself, ensuring the compiler resolves binding expressions against the specific view model type for that template.

When should I explicitly set the binding mode in MAUI XAML data bindings?

Explicitly set the binding mode in MAUI XAML only when the default OneWay behavior does not match your view model update requirements, reducing noise and preventing bugs by omitting Mode when defaults suffice.

How do I implement IValueConverter patterns for .NET MAUI data binding?

Implement IValueConverter and IMultiValueConverter patterns in .NET MAUI by creating classes that convert data between view model properties and XAML UI elements, handling formatting and logic that belongs outside the view model.

Why are my ObservableCollection updates crashing during MAUI AOT builds?

ObservableCollection updates in MAUI AOT builds crash when modifications happen off the UI thread, requiring proper UI thread marshaling and safe update patterns to ensure thread-safe data binding operations.

Does .NET MAUI data binding work with AOT and trimming-safe configurations?

.NET MAUI data binding works with AOT and trimming when using compiled bindings with correct x:DataType placement, avoiding reflection-based bindings that trimmer-safe builds remove during compilation.