From 8a8e240826b1a262eaa7f1291e819f543fa27b5c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 17 Nov 2025 22:03:01 +0000
Subject: [PATCH 01/10] Initial plan
From 99c2dc109882263907aecacb8f9072bda7ade27a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 17 Nov 2025 22:09:31 +0000
Subject: [PATCH 02/10] Update all projects to .NET 10
Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com>
---
.../Finish/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
.../Finish/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
.../Finish/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
.../Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
.../Finish/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
Directory.Build.props | 6 +++---
Directory.Build.targets | 2 +-
Finish/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
Part 2 - MVVM/README.md | 2 +-
Part 2 - MVVM/README.zh-cn.md | 2 +-
Part 2 - MVVM/README.zh-tw.md | 2 +-
Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
Part 3 - Navigation/README.md | 2 +-
Part 3 - Navigation/README.zh-cn.md | 2 +-
Part 3 - Navigation/README.zh-tw.md | 2 +-
Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj | 6 +++---
README.md | 2 +-
21 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/MonkeyFinder.csproj
index 2721a537..4d07a403 100644
--- a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -1,9 +1,9 @@
- net9.0-android
- $(TargetFrameworks);net9.0-ios;net9.0-maccatalyst
- $(TargetFrameworks);net9.0-windows10.0.19041
+ net10.0-android
+ $(TargetFrameworks);net10.0-ios;net10.0-maccatalyst
+ $(TargetFrameworks);net10.0-windows10.0.19041
Exe
MonkeyFinder
true
diff --git a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
index 69ff8423..26921400 100644
--- a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -1,9 +1,9 @@
- net9.0-android
- $(TargetFrameworks);net9.0-ios;net9.0-maccatalyst
- $(TargetFrameworks);net9.0-windows10.0.19041
+ net10.0-android
+ $(TargetFrameworks);net10.0-ios;net10.0-maccatalyst
+ $(TargetFrameworks);net10.0-windows10.0.19041
Exe
MonkeyFinder
true
diff --git a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
index c90e1601..7b9d603f 100644
--- a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -1,9 +1,9 @@
- net9.0-android
- $(TargetFrameworks);net9.0-ios;net9.0-maccatalyst
- $(TargetFrameworks);net9.0-windows10.0.19041
+ net10.0-android
+ $(TargetFrameworks);net10.0-ios;net10.0-maccatalyst
+ $(TargetFrameworks);net10.0-windows10.0.19041
Exe
MonkeyFinder
true
diff --git a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
index fd7c1b94..3a918761 100644
--- a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -1,9 +1,9 @@
- net9.0-android
- $(TargetFrameworks);net9.0-ios;net9.0-maccatalyst
- $(TargetFrameworks);net9.0-windows10.0.19041
+ net10.0-android
+ $(TargetFrameworks);net10.0-ios;net10.0-maccatalyst
+ $(TargetFrameworks);net10.0-windows10.0.19041
Exe
MonkeyFinder
true
diff --git a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
index e1dfa5d7..eda2090a 100644
--- a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -1,9 +1,9 @@
- net9.0-android
- $(TargetFrameworks);net9.0-ios;net9.0-maccatalyst
- $(TargetFrameworks);net9.0-windows10.0.19041
+ net10.0-android
+ $(TargetFrameworks);net10.0-ios;net10.0-maccatalyst
+ $(TargetFrameworks);net10.0-windows10.0.19041
Exe
MonkeyFinder
true
diff --git a/Directory.Build.props b/Directory.Build.props
index fa82de7e..4258b68a 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,8 +1,8 @@
- 15.0
- 15.0
- 21.0
+ 15.0
+ 15.0
+ 21.0
10.0.17763.0
10.0.17763.0
6.5
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 39deecbb..ce8e2ee6 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -11,7 +11,7 @@
-
+
MonkeyFinder
diff --git a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
index 26921400..ca30830f 100644
--- a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
index 7b9d603f..db34cc41 100644
--- a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
index 3a918761..0d166dda 100644
--- a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
index eda2090a..326f8727 100644
--- a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Directory.Build.targets b/Directory.Build.targets
index ce8e2ee6..0d3ced34 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -1,7 +1,7 @@
-
-
+
+
diff --git a/Finish/MonkeyFinder/MonkeyFinder.csproj b/Finish/MonkeyFinder/MonkeyFinder.csproj
index 62ad9090..d805e48a 100644
--- a/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj b/Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj
index 382d7cbe..366f9a06 100644
--- a/Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj b/Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj
index bb6bd744..7795053b 100644
--- a/Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj b/Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj
index bb6bd744..7795053b 100644
--- a/Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj b/Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj
index bb6bd744..7795053b 100644
--- a/Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj b/Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj
index d4bd8845..9b1b245f 100644
--- a/Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
diff --git a/Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj b/Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj
index bb6bd744..7795053b 100644
--- a/Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj
@@ -9,6 +9,7 @@
true
true
enable
+ preview
MonkeyFinder
From 31305995d879feda08c8fb5c55feb8781ec36a96 Mon Sep 17 00:00:00 2001
From: James Montemagno
Date: Mon, 17 Nov 2025 15:20:22 -0800
Subject: [PATCH 06/10] update csproj with essentials stuff
---
.../Finish/MonkeyFinder/MonkeyFinder.csproj | 2 +-
.../Finish/MonkeyFinder/MonkeyFinder.csproj | 2 +-
.../Finish/MonkeyFinder/MonkeyFinder.csproj | 2 +-
.../Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj | 2 +-
.../Finish/MonkeyFinder/MonkeyFinder.csproj | 2 +-
Finish/MonkeyFinder/MonkeyFinder.csproj | 2 +-
Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj | 2 +-
Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj | 2 +-
Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj | 2 +-
Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj | 2 +-
Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj | 2 +-
Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/MonkeyFinder.csproj
index 4d07a403..2aef8ba1 100644
--- a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -44,7 +44,7 @@
-
+
diff --git a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
index 26921400..d034bf95 100644
--- a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -44,6 +44,6 @@
-
+
diff --git a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
index 7b9d603f..c1668475 100644
--- a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -44,7 +44,7 @@
-
+
diff --git a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
index 3a918761..fee66d4b 100644
--- a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -44,7 +44,7 @@
-
+
diff --git a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
index eda2090a..c8463ec4 100644
--- a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -26,7 +26,7 @@
-
+
diff --git a/Finish/MonkeyFinder/MonkeyFinder.csproj b/Finish/MonkeyFinder/MonkeyFinder.csproj
index 62ad9090..f923edb5 100644
--- a/Finish/MonkeyFinder/MonkeyFinder.csproj
+++ b/Finish/MonkeyFinder/MonkeyFinder.csproj
@@ -43,6 +43,6 @@
-
+
diff --git a/Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj b/Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj
index 382d7cbe..50dce780 100644
--- a/Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 1 - Displaying Data/MonkeyFinder/MonkeyFinder.csproj
@@ -44,6 +44,6 @@
-
+
diff --git a/Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj b/Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj
index bb6bd744..ee18be80 100644
--- a/Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 2 - MVVM/MonkeyFinder/MonkeyFinder.csproj
@@ -44,6 +44,6 @@
-
+
diff --git a/Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj b/Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj
index bb6bd744..ee18be80 100644
--- a/Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 3 - Navigation/MonkeyFinder/MonkeyFinder.csproj
@@ -44,6 +44,6 @@
-
+
diff --git a/Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj b/Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj
index bb6bd744..ee18be80 100644
--- a/Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 4 - Platform Features/MonkeyFinder/MonkeyFinder.csproj
@@ -44,6 +44,6 @@
-
+
diff --git a/Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj b/Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj
index d4bd8845..8a98e859 100644
--- a/Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 5 - CollectionView/MonkeyFinder/MonkeyFinder.csproj
@@ -45,6 +45,6 @@
-
+
diff --git a/Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj b/Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj
index bb6bd744..ee18be80 100644
--- a/Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj
+++ b/Part 6 - AppThemes/MonkeyFinder/MonkeyFinder.csproj
@@ -44,6 +44,6 @@
-
+
From 982c2403a4fa7e23e43a16136875f70f7979b164 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 17 Nov 2025 23:25:38 +0000
Subject: [PATCH 07/10] Update all ViewModels and documentation to use MVVM
Toolkit 8.4.0 partial property syntax
Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com>
---
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../ViewModel/MonkeysViewModel.cs | 2 +-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../ViewModel/MonkeysViewModel.cs | 2 +-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../ViewModel/MonkeysViewModel.cs | 2 +-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../ViewModel/MonkeysViewModel.cs | 2 +-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../ViewModel/MonkeysViewModel.cs | 2 +-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../ViewModel/MonkeysViewModel.cs | 2 +-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 10 +++++++-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 10 +++++++-
Part 2 - MVVM/README.md | 16 ++++++-------
Part 2 - MVVM/README.zh-cn.md | 24 +++++++++----------
Part 2 - MVVM/README.zh-tw.md | 24 +++++++++----------
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../MonkeyFinder/ViewModel/BaseViewModel.cs | 4 ++--
.../ViewModel/MonkeyDetailsViewModel.cs | 2 +-
.../ViewModel/MonkeysViewModel.cs | 2 +-
31 files changed, 86 insertions(+), 70 deletions(-)
diff --git a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 0321b1f9..3b087628 100644
--- a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -10,7 +10,7 @@ public MonkeyDetailsViewModel(IMap map)
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
[RelayCommand]
async Task OpenMap()
diff --git a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
index 7fa8a34f..8b8a9adc 100644
--- a/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
+++ b/Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
@@ -29,7 +29,7 @@ async Task GoToDetails(Monkey monkey)
}
[ObservableProperty]
- bool isRefreshing;
+ public partial bool IsRefreshing { get; set; }
[RelayCommand]
async Task GetMonkeysAsync()
diff --git a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 0321b1f9..3b087628 100644
--- a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -10,7 +10,7 @@ public MonkeyDetailsViewModel(IMap map)
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
[RelayCommand]
async Task OpenMap()
diff --git a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
index 7fa8a34f..8b8a9adc 100644
--- a/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
+++ b/Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
@@ -29,7 +29,7 @@ async Task GoToDetails(Monkey monkey)
}
[ObservableProperty]
- bool isRefreshing;
+ public partial bool IsRefreshing { get; set; }
[RelayCommand]
async Task GetMonkeysAsync()
diff --git a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 0321b1f9..3b087628 100644
--- a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -10,7 +10,7 @@ public MonkeyDetailsViewModel(IMap map)
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
[RelayCommand]
async Task OpenMap()
diff --git a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
index 7fa8a34f..8b8a9adc 100644
--- a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
+++ b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
@@ -29,7 +29,7 @@ async Task GoToDetails(Monkey monkey)
}
[ObservableProperty]
- bool isRefreshing;
+ public partial bool IsRefreshing { get; set; }
[RelayCommand]
async Task GetMonkeysAsync()
diff --git a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 0321b1f9..3b087628 100644
--- a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -10,7 +10,7 @@ public MonkeyDetailsViewModel(IMap map)
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
[RelayCommand]
async Task OpenMap()
diff --git a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
index 7fa8a34f..8b8a9adc 100644
--- a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
+++ b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
@@ -29,7 +29,7 @@ async Task GoToDetails(Monkey monkey)
}
[ObservableProperty]
- bool isRefreshing;
+ public partial bool IsRefreshing { get; set; }
[RelayCommand]
async Task GetMonkeysAsync()
diff --git a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 0321b1f9..3b087628 100644
--- a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -10,7 +10,7 @@ public MonkeyDetailsViewModel(IMap map)
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
[RelayCommand]
async Task OpenMap()
diff --git a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
index 7fa8a34f..8b8a9adc 100644
--- a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
+++ b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
@@ -29,7 +29,7 @@ async Task GoToDetails(Monkey monkey)
}
[ObservableProperty]
- bool isRefreshing;
+ public partial bool IsRefreshing { get; set; }
[RelayCommand]
async Task GetMonkeysAsync()
diff --git a/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs b/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Finish/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 0321b1f9..3b087628 100644
--- a/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -10,7 +10,7 @@ public MonkeyDetailsViewModel(IMap map)
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
[RelayCommand]
async Task OpenMap()
diff --git a/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs b/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
index 7fa8a34f..8b8a9adc 100644
--- a/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
+++ b/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs
@@ -29,7 +29,7 @@ async Task GoToDetails(Monkey monkey)
}
[ObservableProperty]
- bool isRefreshing;
+ public partial bool IsRefreshing { get; set; }
[RelayCommand]
async Task GetMonkeysAsync()
diff --git a/Part 1 - Displaying Data/MonkeyFinder/ViewModel/BaseViewModel.cs b/Part 1 - Displaying Data/MonkeyFinder/ViewModel/BaseViewModel.cs
index 0205f46e..e7316cef 100644
--- a/Part 1 - Displaying Data/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Part 1 - Displaying Data/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -1,5 +1,13 @@
namespace MonkeyFinder.ViewModel;
-public class BaseViewModel
+public partial class BaseViewModel : ObservableObject
{
+ [ObservableProperty]
+ [NotifyPropertyChangedFor(nameof(IsNotBusy))]
+ public partial bool IsBusy { get; set; }
+
+ [ObservableProperty]
+ public partial string Title { get; set; }
+
+ public bool IsNotBusy => !IsBusy;
}
diff --git a/Part 2 - MVVM/MonkeyFinder/ViewModel/BaseViewModel.cs b/Part 2 - MVVM/MonkeyFinder/ViewModel/BaseViewModel.cs
index 0205f46e..e7316cef 100644
--- a/Part 2 - MVVM/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Part 2 - MVVM/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -1,5 +1,13 @@
namespace MonkeyFinder.ViewModel;
-public class BaseViewModel
+public partial class BaseViewModel : ObservableObject
{
+ [ObservableProperty]
+ [NotifyPropertyChangedFor(nameof(IsNotBusy))]
+ public partial bool IsBusy { get; set; }
+
+ [ObservableProperty]
+ public partial string Title { get; set; }
+
+ public bool IsNotBusy => !IsBusy;
}
diff --git a/Part 2 - MVVM/README.md b/Part 2 - MVVM/README.md
index f4b65671..e921b557 100644
--- a/Part 2 - MVVM/README.md
+++ b/Part 2 - MVVM/README.md
@@ -134,10 +134,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
@@ -145,24 +145,24 @@ public partial class BaseViewModel : ObservableObject
Here, we can see that our code has been greatly simplified with an `ObservableObject` base class that implements `INotifyPropertyChanged` and also attributes to expose our properties.
-Note that both isBusy and title have the `[ObservableProperty]` attribute attached to it. The code that is generated looks nearly identical to what we manually wrote. Additionally, the isBusy property has `[NotifyPropertyChangedFor(nameof(IsNotBusy))]`, which will also notify `IsNotBusy` when the value changes. To see the generated code head to the project and then expand **Dependencies -> net10.0-android -> Analyzers -> CommunityToolkit.Mvvm.SourceGenerators -> CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator** and open `MonkeyFinder.ViewModel.BaseViewModel.cs`:
+Note that both IsBusy and Title have the `[ObservableProperty]` attribute attached to them. With CommunityToolkit.Mvvm 8.4.0, we now use **partial properties** instead of fields. This provides better AOT (Ahead-of-Time) compilation support and is the recommended approach. The code generator will create the backing field and property implementation automatically. Additionally, the IsBusy property has `[NotifyPropertyChangedFor(nameof(IsNotBusy))]`, which will also notify `IsNotBusy` when the value changes. To see the generated code head to the project and then expand **Dependencies -> net10.0-android -> Analyzers -> CommunityToolkit.Mvvm.SourceGenerators -> CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator** and open `MonkeyFinder.ViewModel.BaseViewModel.cs`:
Here is what our `IsBusy` looks like:
```csharp
-[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.3.0.0")]
+[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.4.0.0")]
[global::System.Diagnostics.DebuggerNonUserCode]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public bool IsBusy
{
- get => isBusy;
+ get => field;
set
{
- if (!global::System.Collections.Generic.EqualityComparer.Default.Equals(isBusy, value))
+ if (!global::System.Collections.Generic.EqualityComparer.Default.Equals(field, value))
{
OnPropertyChanging(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangingArgs.IsBusy);
- isBusy = value;
+ field = value;
OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.IsBusy);
OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.IsNotBusy);
}
@@ -170,7 +170,7 @@ public bool IsBusy
}
```
-This code may look a bit scary, but since it is auto-generated it adds additional attributes to avoid conflicts. It is also highly optimized with caching as well.
+This code may look a bit scary, but since it is auto-generated it adds additional attributes to avoid conflicts. It is also highly optimized with caching as well. Note the use of the `field` keyword, which is a C# 14 feature that provides direct access to the compiler-generated backing field.
The same library will also help us handle click events aka `Commands` in the future.
diff --git a/Part 2 - MVVM/README.zh-cn.md b/Part 2 - MVVM/README.zh-cn.md
index 1a0c29e4..afd115df 100644
--- a/Part 2 - MVVM/README.zh-cn.md
+++ b/Part 2 - MVVM/README.zh-cn.md
@@ -53,8 +53,8 @@ public void OnPropertyChanged([CallerMemberName] string name = null) =>
```csharp
public class BaseViewModel : INotifyPropertyChanged
{
- bool isBusy;
- string title;
+ public partial bool IsBusy { get; set; }
+ public partial string Title { get; set; }
//...
}
```
@@ -66,12 +66,12 @@ public class BaseViewModel : INotifyPropertyChanged
//...
public bool IsBusy
{
- get => isBusy;
+ get => field;
set
{
if (isBusy == value)
return;
- isBusy = value;
+ field = value;
OnPropertyChanged();
}
}
@@ -101,12 +101,12 @@ public class BaseViewModel : INotifyPropertyChanged
//...
public bool IsBusy
{
- get => isBusy;
+ get => field;
set
{
if (isBusy == value)
return;
- isBusy = value;
+ field = value;
OnPropertyChanged();
// Also raise the IsNotBusy property changed
OnPropertyChanged(nameof(IsNotBusy));
@@ -131,10 +131,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
@@ -147,18 +147,18 @@ public partial class BaseViewModel : ObservableObject
这是我们的 `IsBusy` 属性:
```csharp
-[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.3.0.0")]
+[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.4.0.0")]
[global::System.Diagnostics.DebuggerNonUserCode]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public bool IsBusy
{
- get => isBusy;
+ get => field;
set
{
- if (!global::System.Collections.Generic.EqualityComparer.Default.Equals(isBusy, value))
+ if (!global::System.Collections.Generic.EqualityComparer.Default.Equals(field, value))
{
OnPropertyChanging(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangingArgs.IsBusy);
- isBusy = value;
+ field = value;
OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.IsBusy);
OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.IsNotBusy);
}
diff --git a/Part 2 - MVVM/README.zh-tw.md b/Part 2 - MVVM/README.zh-tw.md
index 10dd7faa..067d512c 100644
--- a/Part 2 - MVVM/README.zh-tw.md
+++ b/Part 2 - MVVM/README.zh-tw.md
@@ -53,8 +53,8 @@ public void OnPropertyChanged([CallerMemberName] string name = null) =>
```csharp
public class BaseViewModel : INotifyPropertyChanged
{
- bool isBusy;
- string title;
+ public partial bool IsBusy { get; set; }
+ public partial string Title { get; set; }
//...
}
```
@@ -66,12 +66,12 @@ public class BaseViewModel : INotifyPropertyChanged
//...
public bool IsBusy
{
- get => isBusy;
+ get => field;
set
{
if (isBusy == value)
return;
- isBusy = value;
+ field = value;
OnPropertyChanged();
}
}
@@ -101,12 +101,12 @@ public class BaseViewModel : INotifyPropertyChanged
//...
public bool IsBusy
{
- get => isBusy;
+ get => field;
set
{
if (isBusy == value)
return;
- isBusy = value;
+ field = value;
OnPropertyChanged();
// Also raise the IsNotBusy property changed
OnPropertyChanged(nameof(IsNotBusy));
@@ -131,10 +131,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
@@ -147,18 +147,18 @@ public partial class BaseViewModel : ObservableObject
以下是在編譯時期自動產生的 `IsBusy` 屬性:
```csharp
-[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.3.0.0")]
+[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.4.0.0")]
[global::System.Diagnostics.DebuggerNonUserCode]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public bool IsBusy
{
- get => isBusy;
+ get => field;
set
{
- if (!global::System.Collections.Generic.EqualityComparer.Default.Equals(isBusy, value))
+ if (!global::System.Collections.Generic.EqualityComparer.Default.Equals(field, value))
{
OnPropertyChanging(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangingArgs.IsBusy);
- isBusy = value;
+ field = value;
OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.IsBusy);
OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.IsNotBusy);
}
diff --git a/Part 3 - Navigation/MonkeyFinder/ViewModel/BaseViewModel.cs b/Part 3 - Navigation/MonkeyFinder/ViewModel/BaseViewModel.cs
index e78dc9a6..7f1a7aa3 100644
--- a/Part 3 - Navigation/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Part 3 - Navigation/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Part 4 - Platform Features/MonkeyFinder/ViewModel/BaseViewModel.cs b/Part 4 - Platform Features/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Part 4 - Platform Features/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Part 4 - Platform Features/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Part 4 - Platform Features/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Part 4 - Platform Features/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 165eeab9..46065d10 100644
--- a/Part 4 - Platform Features/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Part 4 - Platform Features/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -8,5 +8,5 @@ public MonkeyDetailsViewModel()
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
}
diff --git a/Part 5 - CollectionView/MonkeyFinder/ViewModel/BaseViewModel.cs b/Part 5 - CollectionView/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Part 5 - CollectionView/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Part 5 - CollectionView/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Part 5 - CollectionView/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Part 5 - CollectionView/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 0321b1f9..3b087628 100644
--- a/Part 5 - CollectionView/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Part 5 - CollectionView/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -10,7 +10,7 @@ public MonkeyDetailsViewModel(IMap map)
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
[RelayCommand]
async Task OpenMap()
diff --git a/Part 6 - AppThemes/MonkeyFinder/ViewModel/BaseViewModel.cs b/Part 6 - AppThemes/MonkeyFinder/ViewModel/BaseViewModel.cs
index 4d3c5ead..e7316cef 100644
--- a/Part 6 - AppThemes/MonkeyFinder/ViewModel/BaseViewModel.cs
+++ b/Part 6 - AppThemes/MonkeyFinder/ViewModel/BaseViewModel.cs
@@ -4,10 +4,10 @@ public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
- bool isBusy;
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
- string title;
+ public partial string Title { get; set; }
public bool IsNotBusy => !IsBusy;
}
diff --git a/Part 6 - AppThemes/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs b/Part 6 - AppThemes/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
index 0321b1f9..3b087628 100644
--- a/Part 6 - AppThemes/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
+++ b/Part 6 - AppThemes/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs
@@ -10,7 +10,7 @@ public MonkeyDetailsViewModel(IMap map)
}
[ObservableProperty]
- Monkey monkey;
+ public partial Monkey Monkey { get; set; }
[RelayCommand]
async Task OpenMap()
diff --git a/Part 6 - AppThemes/MonkeyFinder/ViewModel/MonkeysViewModel.cs b/Part 6 - AppThemes/MonkeyFinder/ViewModel/MonkeysViewModel.cs
index 80304219..a41221f1 100644
--- a/Part 6 - AppThemes/MonkeyFinder/ViewModel/MonkeysViewModel.cs
+++ b/Part 6 - AppThemes/MonkeyFinder/ViewModel/MonkeysViewModel.cs
@@ -17,7 +17,7 @@ public MonkeysViewModel(MonkeyService monkeyService, IConnectivity connectivity,
}
[ObservableProperty]
- bool isRefreshing;
+ public partial bool IsRefreshing { get; set; }
[RelayCommand]
async Task GetMonkeysAsync()
From 494d9f52c44554167c49649f1ebaf06538daac7d Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 17 Nov 2025 23:41:04 +0000
Subject: [PATCH 08/10] Fix README: Keep manual implementation examples with
field syntax
Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com>
---
Part 2 - MVVM/README.zh-cn.md | 4 ++--
Part 2 - MVVM/README.zh-tw.md | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Part 2 - MVVM/README.zh-cn.md b/Part 2 - MVVM/README.zh-cn.md
index afd115df..d1430f9f 100644
--- a/Part 2 - MVVM/README.zh-cn.md
+++ b/Part 2 - MVVM/README.zh-cn.md
@@ -53,8 +53,8 @@ public void OnPropertyChanged([CallerMemberName] string name = null) =>
```csharp
public class BaseViewModel : INotifyPropertyChanged
{
- public partial bool IsBusy { get; set; }
- public partial string Title { get; set; }
+ bool isBusy;
+ string title;
//...
}
```
diff --git a/Part 2 - MVVM/README.zh-tw.md b/Part 2 - MVVM/README.zh-tw.md
index 067d512c..cb91c244 100644
--- a/Part 2 - MVVM/README.zh-tw.md
+++ b/Part 2 - MVVM/README.zh-tw.md
@@ -53,8 +53,8 @@ public void OnPropertyChanged([CallerMemberName] string name = null) =>
```csharp
public class BaseViewModel : INotifyPropertyChanged
{
- public partial bool IsBusy { get; set; }
- public partial string Title { get; set; }
+ bool isBusy;
+ string title;
//...
}
```
From 0adb1ad9db6947eb31a2019533986f24e09d5068 Mon Sep 17 00:00:00 2001
From: James Montemagno
Date: Mon, 17 Nov 2025 15:48:07 -0800
Subject: [PATCH 09/10] Change CardView base class from Frame to Border
CardView now inherits from Border instead of Frame, enabling use of Border-specific styling and features. This may affect the appearance and layout of CardView components in the application.
---
.../Finish/MonkeyFinder/Resources/Styles/Styles.cs | 2 +-
.../Finish/MonkeyFinder/Resources/Styles/Styles.cs | 2 +-
.../Finish/MonkeyFinder/Resources/Styles/Styles.cs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/Resources/Styles/Styles.cs b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/Resources/Styles/Styles.cs
index f7c77a3b..0759725d 100644
--- a/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/Resources/Styles/Styles.cs
+++ b/Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/Resources/Styles/Styles.cs
@@ -73,7 +73,7 @@ public ButtonOutline()
}
}
- public class CardView : Frame
+ public class CardView : Border
{
public CardView()
{
diff --git a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/Resources/Styles/Styles.cs b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/Resources/Styles/Styles.cs
index 3ff1112e..99a69688 100644
--- a/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/Resources/Styles/Styles.cs
+++ b/Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/Resources/Styles/Styles.cs
@@ -73,7 +73,7 @@ public StandardButton()
}
}
- public class CardView : Frame
+ public class CardView : Border
{
public CardView()
{
diff --git a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/Resources/Styles/Styles.cs b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/Resources/Styles/Styles.cs
index 3ff1112e..99a69688 100644
--- a/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/Resources/Styles/Styles.cs
+++ b/Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/Resources/Styles/Styles.cs
@@ -73,7 +73,7 @@ public StandardButton()
}
}
- public class CardView : Frame
+ public class CardView : Border
{
public CardView()
{
From 8e4d7e36a1c87c139f4407886b813383efae289d Mon Sep 17 00:00:00 2001
From: James Montemagno
Date: Mon, 17 Nov 2025 15:56:53 -0800
Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=94=A7=20Refactor=20IsBusy=20proper?=
=?UTF-8?q?ty=20in=20BaseViewModel?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Update getter to use `isBusy` instead of `field`
- Ensure setter updates `isBusy` and raises PropertyChanged events
---
Part 2 - MVVM/README.zh-cn.md | 8 ++++----
Part 2 - MVVM/README.zh-tw.md | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/Part 2 - MVVM/README.zh-cn.md b/Part 2 - MVVM/README.zh-cn.md
index d1430f9f..c4902bd7 100644
--- a/Part 2 - MVVM/README.zh-cn.md
+++ b/Part 2 - MVVM/README.zh-cn.md
@@ -66,12 +66,12 @@ public class BaseViewModel : INotifyPropertyChanged
//...
public bool IsBusy
{
- get => field;
+ get => isBusy;
set
{
if (isBusy == value)
return;
- field = value;
+ isBusy = value;
OnPropertyChanged();
}
}
@@ -101,12 +101,12 @@ public class BaseViewModel : INotifyPropertyChanged
//...
public bool IsBusy
{
- get => field;
+ get => isBusy;
set
{
if (isBusy == value)
return;
- field = value;
+ isBusy = value;
OnPropertyChanged();
// Also raise the IsNotBusy property changed
OnPropertyChanged(nameof(IsNotBusy));
diff --git a/Part 2 - MVVM/README.zh-tw.md b/Part 2 - MVVM/README.zh-tw.md
index cb91c244..f74c66d0 100644
--- a/Part 2 - MVVM/README.zh-tw.md
+++ b/Part 2 - MVVM/README.zh-tw.md
@@ -66,12 +66,12 @@ public class BaseViewModel : INotifyPropertyChanged
//...
public bool IsBusy
{
- get => field;
+ get => isBusy;
set
{
if (isBusy == value)
return;
- field = value;
+ isBusy = value;
OnPropertyChanged();
}
}
@@ -101,12 +101,12 @@ public class BaseViewModel : INotifyPropertyChanged
//...
public bool IsBusy
{
- get => field;
+ get => isBusy;
set
{
if (isBusy == value)
return;
- field = value;
+ isBusy = value;
OnPropertyChanged();
// Also raise the IsNotBusy property changed
OnPropertyChanged(nameof(IsNotBusy));