From 49de18dc2f329c486dde33d59f163c11b0e14d05 Mon Sep 17 00:00:00 2001 From: ahall Date: Sat, 11 Jul 2026 10:39:12 +0100 Subject: [PATCH] fix: use partial-property pattern for ObservableProperty in TodoApp.Uno TodoListViewModel Converts isRefreshing, items, and title from the legacy [ObservableProperty] private field pattern to the modern [ObservableProperty] public partial property pattern, matching TodoApp.WinUI3's TodoListViewModel. This resolves MVVMTK0045 warnings on the net10.0-windows10.0.26100 head, since the field-based pattern is not WinRT/AOT-safe. Fixes #538 --- .../TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs index cc6ee471..9c0acd04 100644 --- a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs +++ b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs @@ -18,13 +18,13 @@ public partial class TodoListViewModel(AppDbContext service) : ObservableRecipie internal event EventHandler NotificationHandler; [ObservableProperty] - private bool isRefreshing; + public partial bool IsRefreshing { get; set; } [ObservableProperty] - private ConcurrentObservableCollection items = []; + public partial ConcurrentObservableCollection Items { get; set; } = []; [ObservableProperty] - private string title = string.Empty; + public partial string Title { get; set; } = string.Empty; [RelayCommand] public async Task AddItemAsync(CancellationToken cancellationToken = default)