From aa6ec7f025986cdeff308d23d4e48ea173dc6596 Mon Sep 17 00:00:00 2001 From: nmetulev Date: Wed, 13 May 2026 21:38:03 -0700 Subject: [PATCH] Fix ObservableProperty example to use partial property syntax Legacy field form emits MVVMTK0045 in WinRT/WinUI projects (CommunityToolkit.Mvvm 8.4+). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../skills/winui-packaging/references/sourcegen-patterns.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/winui/skills/winui-packaging/references/sourcegen-patterns.md b/plugins/winui/skills/winui-packaging/references/sourcegen-patterns.md index 2684eb7..ea3475c 100644 --- a/plugins/winui/skills/winui-packaging/references/sourcegen-patterns.md +++ b/plugins/winui/skills/winui-packaging/references/sourcegen-patterns.md @@ -96,10 +96,12 @@ ShowWindow ## CommunityToolkit.Mvvm Source Generators +Use partial properties (CommunityToolkit.Mvvm 8.4+). The legacy field form emits **MVVMTK0045** in WinRT/WinUI projects. + ```csharp public partial class SettingsViewModel : ObservableObject { - [ObservableProperty] private string _userName = string.Empty; + [ObservableProperty] public partial string UserName { get; set; } [RelayCommand] private async Task SaveAsync() => await _service.SaveAsync(UserName); } ```