maui-data-binding

仓库创建 2026年2月4日最近提交 18 小时前SkillHot 收录 8 小时前
▸ 精选理由

帮助 MAUI 开发者启用编译时安全的绑定并修复通知/绑定问题,提高稳定性与可维护性。

这个 Skill 做什么

提供 .NET MAUI 中 XAML/C# 数据绑定、INotify 与 MVVM 最佳实践的详细指导。

解决 .NET MAUI 下 XAML/C# 的数据绑定痛点,让 UI 与 ViewModel 的属性绑定既安全又高效。常用场景包括加 x:DataType 编译绑定、实现 INotifyPropertyChanged/ObservableObject、写 IValueConverter、选 binding mode 或做相对绑定。特别强调编译时校验和把绑定警告当错误,能显著减少运行时丢失更新的问题。

▸ 展开 SKILL.md 英文原文

Guidance for .NET MAUI XAML and C# data bindings — compiled bindings, INotifyPropertyChanged / ObservableObject, value converters, binding modes, multi-binding, relative bindings, fallbacks, and MVVM best practices. USE FOR: setting up compiled bindings with x:DataType, implementing INotifyPropertyChanged or CommunityToolkit ObservableObject, creating IValueConverter / IMultiValueConverter, choosing binding modes, configuring BindingContext, relative bindings, binding fallbacks, StringFormat, code-behind SetBinding with lambdas, and enforcing XC0022/XC0025 warnings. DO NOT USE FOR: CollectionView item templates and layouts (use maui-collectionview), Shell navigation data passing (use maui-shell-navigation), dependency injection (use maui-dependency-injection), or animations triggered by property changes (use .NET MAUI animation APIs).

开发编程.NET MAUI数据绑定MVVMXAML通用
4.8k
Stars
351
Forks
40
仓库内 Skill
+610
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-maui/skills/maui-data-binding/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-maui/skills/maui-data-binding/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# .NET MAUI Data Binding

Wire UI controls to ViewModel properties with compile-time safety, correct
change notification, and minimal overhead. Prefer compiled bindings everywhere
and treat binding warnings as build errors.

## When to Use

- Adding `x:DataType` compiled bindings to a new or existing page
- Implementing `INotifyPropertyChanged` or CommunityToolkit `ObservableObject`
- Creating or consuming `IValueConverter` / `IMultiValueConverter`
- Choosing the correct `BindingMode` for a control property
- Setting `BindingContext` in XAML or code-behind
- Using relative bindings (`Self`, `AncestorType`, `TemplatedParent`)
- Applying `StringFormat`, `FallbackValue`, or `TargetNullValue`
- 
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有