diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 021ff531..09b5216b 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -13,7 +13,7 @@ on: - '*' env: - LATEST_NET_VERSION: '9.0.x' + LATEST_NET_VERSION: '10.0.x' PathToCommunityToolkitBenchmarkCsproj: 'src/CommunityToolkit.Maui.Markup.Benchmarks/CommunityToolkit.Maui.Markup.Benchmarks.csproj' concurrency: @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, macos-15] + os: [windows-latest, macos-26] steps: - name: Checkout code diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index f101a299..6f7c65ca 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -18,15 +18,15 @@ env: # When we create a tag, we set the NuGet version to the tag number, the below values are only for PR builds. CurrentSemanticVersionBase: '99.0.0' # Only used for PR builds NugetPackageVersion: '99.0.0-preview${{ github.run_number }}' # Only used for PR builds - NET_VERSION: '9.0.x' + NET_VERSION: '10.0.x' RunPoliCheck: false - PathToLibrarySolution: 'src/CommunityToolkit.Maui.Markup.sln' - PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Markup.Sample.sln' + PathToLibrarySolution: 'src/CommunityToolkit.Maui.Markup.slnx' + PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Markup.Sample.slnx' PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj' PathToCommunityToolkitSampleCsproj: 'samples/CommunityToolkit.Maui.Markup.Sample/CommunityToolkit.Maui.Markup.Sample.csproj' PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit.Maui.Markup.UnitTests/CommunityToolkit.Maui.Markup.UnitTests.csproj' PathToCommunityToolkitSourceGeneratorsCsproj: 'src/CommunityToolkit.Maui.Markup.SourceGenerators/CommunityToolkit.Maui.Markup.SourceGenerators.csproj' - Xcode_Version: '16.3' + Xcode_Version: '26.0.1' ShouldCheckDependencies: true concurrency: @@ -40,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, macos-15] + os: [windows-latest, macos-26] steps: - name: Checkout code uses: actions/checkout@v5 @@ -49,7 +49,7 @@ jobs: if: runner.os == 'macOS' uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: latest-stable + xcode-version: ${{ env.Xcode_Version }} - name: Install Latest .NET SDK, v${{ env.NET_VERSION }} uses: actions/setup-dotnet@v5 @@ -85,7 +85,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, macos-15] + os: [windows-latest, macos-26] steps: - name: Checkout code uses: actions/checkout@v5 diff --git a/Directory.Build.props b/Directory.Build.props index cb1d9c9f..b9a84e26 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ enable NETSDK1023 - net9.0 + net10.0 preview enable true @@ -20,8 +20,7 @@ all - 9.0.120 - 10.0.0 + 10.0.0 12.3.0 true true @@ -91,7 +90,7 @@ IL2090,IL2091,IL2092,IL2093,IL2094,IL2095,IL2096,IL2097,IL2098,IL2099, IL2100,IL2101,IL2102,IL2103,IL2104,IL2105,IL2106,IL2107,IL2108,IL2109, IL2110,IL2111,IL2112,IL2113,IL2114,IL2115,IL2116,IL2117,IL2118,IL2119, - IL2120,IL2121,IL2122, + IL2120,IL2121,IL2122,IL2123, IL3050,IL3051,IL3052,IL3053,IL3054,IL3055,IL3056, RS1038 diff --git a/global.json b/global.json index 478da3ed..fe7e453b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.203", + "version": "10.0.100", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/samples/CommunityToolkit.Maui.Markup.Sample.sln b/samples/CommunityToolkit.Maui.Markup.Sample.sln deleted file mode 100644 index 14dd228a..00000000 --- a/samples/CommunityToolkit.Maui.Markup.Sample.sln +++ /dev/null @@ -1,63 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31606.5 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.Markup.Sample", "CommunityToolkit.Maui.Markup.Sample\CommunityToolkit.Maui.Markup.Sample.csproj", "{A15CD688-94E8-483B-8B87-A173B2DD0E40}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.Markup", "..\src\CommunityToolkit.Maui.Markup\CommunityToolkit.Maui.Markup.csproj", "{A4511CE3-FBBE-467E-AC49-522D3D308189}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FB2C97E0-5C47-4A80-BE66-6DE982933BD0}" - ProjectSection(SolutionItems) = preProject - ..\.editorconfig = ..\.editorconfig - ..\Directory.Build.props = ..\Directory.Build.props - ..\global.json = ..\global.json - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.Markup.UnitTests", "..\src\CommunityToolkit.Maui.Markup.UnitTests\CommunityToolkit.Maui.Markup.UnitTests.csproj", "{F45A2C29-DDD2-49A8-B4D9-57150F80AD36}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{A919D3AA-043D-441B-9DF5-18ED84B7FC08}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.Markup.SourceGenerators", "..\src\CommunityToolkit.Maui.Markup.SourceGenerators\CommunityToolkit.Maui.Markup.SourceGenerators.csproj", "{533792FE-99CD-4B5B-A8B2-51A8BE3852A5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Maui.Markup.Benchmarks", "..\src\CommunityToolkit.Maui.Markup.Benchmarks\CommunityToolkit.Maui.Markup.Benchmarks.csproj", "{8C1B7D06-75D7-40AC-9FDB-344BF5FCCD5E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A15CD688-94E8-483B-8B87-A173B2DD0E40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A15CD688-94E8-483B-8B87-A173B2DD0E40}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A15CD688-94E8-483B-8B87-A173B2DD0E40}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {A15CD688-94E8-483B-8B87-A173B2DD0E40}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A15CD688-94E8-483B-8B87-A173B2DD0E40}.Release|Any CPU.Build.0 = Release|Any CPU - {A15CD688-94E8-483B-8B87-A173B2DD0E40}.Release|Any CPU.Deploy.0 = Release|Any CPU - {A4511CE3-FBBE-467E-AC49-522D3D308189}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A4511CE3-FBBE-467E-AC49-522D3D308189}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A4511CE3-FBBE-467E-AC49-522D3D308189}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A4511CE3-FBBE-467E-AC49-522D3D308189}.Release|Any CPU.Build.0 = Release|Any CPU - {F45A2C29-DDD2-49A8-B4D9-57150F80AD36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F45A2C29-DDD2-49A8-B4D9-57150F80AD36}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F45A2C29-DDD2-49A8-B4D9-57150F80AD36}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F45A2C29-DDD2-49A8-B4D9-57150F80AD36}.Release|Any CPU.Build.0 = Release|Any CPU - {533792FE-99CD-4B5B-A8B2-51A8BE3852A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {533792FE-99CD-4B5B-A8B2-51A8BE3852A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {533792FE-99CD-4B5B-A8B2-51A8BE3852A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {533792FE-99CD-4B5B-A8B2-51A8BE3852A5}.Release|Any CPU.Build.0 = Release|Any CPU - {8C1B7D06-75D7-40AC-9FDB-344BF5FCCD5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C1B7D06-75D7-40AC-9FDB-344BF5FCCD5E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C1B7D06-75D7-40AC-9FDB-344BF5FCCD5E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C1B7D06-75D7-40AC-9FDB-344BF5FCCD5E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {A15CD688-94E8-483B-8B87-A173B2DD0E40} = {A919D3AA-043D-441B-9DF5-18ED84B7FC08} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572} - EndGlobalSection -EndGlobal diff --git a/samples/CommunityToolkit.Maui.Markup.Sample.slnx b/samples/CommunityToolkit.Maui.Markup.Sample.slnx new file mode 100644 index 00000000..d6538348 --- /dev/null +++ b/samples/CommunityToolkit.Maui.Markup.Sample.slnx @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs b/samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs index 158749da..42c0bd8a 100644 --- a/samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs +++ b/samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs @@ -2,7 +2,6 @@ namespace CommunityToolkit.Maui.Markup.Sample; -[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")] partial class AppShell : Shell { static readonly ReadOnlyDictionary pageRouteMappingDictionary = new Dictionary( diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/CommunityToolkit.Maui.Markup.Sample.csproj b/samples/CommunityToolkit.Maui.Markup.Sample/CommunityToolkit.Maui.Markup.Sample.csproj index 81c6edf7..119a16fc 100644 --- a/samples/CommunityToolkit.Maui.Markup.Sample/CommunityToolkit.Maui.Markup.Sample.csproj +++ b/samples/CommunityToolkit.Maui.Markup.Sample/CommunityToolkit.Maui.Markup.Sample.csproj @@ -35,11 +35,13 @@ CsWinRT1028 - - - - - true + + + + false + true + partial @@ -59,7 +61,7 @@ - + @@ -75,4 +77,8 @@ + + + + diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/HotReloadHandler.cs b/samples/CommunityToolkit.Maui.Markup.Sample/HotReloadHandler.cs index 47d516a7..3657e01f 100644 --- a/samples/CommunityToolkit.Maui.Markup.Sample/HotReloadHandler.cs +++ b/samples/CommunityToolkit.Maui.Markup.Sample/HotReloadHandler.cs @@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis; namespace CommunityToolkit.Maui.Markup.Sample; -[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")] class HotReloadHandler : ICommunityToolkitHotReloadHandler { public async void OnHotReload(IReadOnlyList types) diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/MauiProgram.cs b/samples/CommunityToolkit.Maui.Markup.Sample/MauiProgram.cs index 37af4d66..7646a4a1 100644 --- a/samples/CommunityToolkit.Maui.Markup.Sample/MauiProgram.cs +++ b/samples/CommunityToolkit.Maui.Markup.Sample/MauiProgram.cs @@ -1,10 +1,8 @@ -using System.Diagnostics.CodeAnalysis; -using Microsoft.Extensions.Http.Resilience; +using Microsoft.Extensions.Http.Resilience; using Polly; using Refit; namespace CommunityToolkit.Maui.Markup.Sample; -[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")] public class MauiProgram { public static MauiApp CreateMauiApp() diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/Pages/NewsPage.cs b/samples/CommunityToolkit.Maui.Markup.Sample/Pages/NewsPage.cs index 37503516..6d3ba6ef 100644 --- a/samples/CommunityToolkit.Maui.Markup.Sample/Pages/NewsPage.cs +++ b/samples/CommunityToolkit.Maui.Markup.Sample/Pages/NewsPage.cs @@ -1,13 +1,10 @@ -using System.Diagnostics.CodeAnalysis; - -namespace CommunityToolkit.Maui.Markup.Sample.Pages; +namespace CommunityToolkit.Maui.Markup.Sample.Pages; sealed partial class NewsPage : BaseContentPage { readonly IDispatcher dispatcher; readonly RefreshView refreshView; - [RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")] public NewsPage(IDispatcher dispatcher, NewsViewModel newsViewModel) : base(newsViewModel, "Top Stories") { @@ -49,7 +46,6 @@ protected override void OnAppearing() static bool IsNullOrEmpty(in IEnumerable? enumerable) => !enumerable?.GetEnumerator().MoveNext() ?? true; } - [RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")] async void HandleSelectionChanged(object? sender, SelectionChangedEventArgs e) { ArgumentNullException.ThrowIfNull(sender); @@ -65,13 +61,13 @@ async void HandleSelectionChanged(object? sender, SelectionChangedEventArgs e) } else { - await DisplayAlert("Invalid Article", "ASK HN articles have no url", "OK"); + await DisplayAlertAsync("Invalid Article", "ASK HN articles have no url", "OK"); } } } async void HandlePullToRefreshFailed(object? sender, string message) => - await dispatcher.DispatchAsync(() => DisplayAlert("Refresh Failed", message, "OK")); + await dispatcher.DispatchAsync(() => DisplayAlertAsync("Refresh Failed", message, "OK")); bool TryRefreshCollectionView() { @@ -86,14 +82,12 @@ bool TryRefreshCollectionView() void HandleNumberOfTopStoriesToFetchChanged(object? sender, int e) => TryRefreshCollectionView(); - [RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")] Task NavigateToSettingsPage() => dispatcher.DispatchAsync(() => { var route = AppShell.GetRoute(); return Shell.Current.GoToAsync(route); }); - [RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")] Task NavigateToNewsDetailPage(StoryModel storyModel) => dispatcher.DispatchAsync(() => { var route = AppShell.GetRoute(); diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/Pages/SettingsPage.cs b/samples/CommunityToolkit.Maui.Markup.Sample/Pages/SettingsPage.cs index 45875e77..261c2247 100644 --- a/samples/CommunityToolkit.Maui.Markup.Sample/Pages/SettingsPage.cs +++ b/samples/CommunityToolkit.Maui.Markup.Sample/Pages/SettingsPage.cs @@ -1,11 +1,9 @@ -using System.Diagnostics.CodeAnalysis; -using Microsoft.Maui.Layouts; +using Microsoft.Maui.Layouts; namespace CommunityToolkit.Maui.Markup.Sample.Pages; sealed partial class SettingsPage : BaseContentPage { - [RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")] public SettingsPage(SettingsViewModel settingsViewModel) : base(settingsViewModel, "Settings") { Content = new AbsoluteLayout diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/Platforms/MacCatalyst/AppDelegate.cs b/samples/CommunityToolkit.Maui.Markup.Sample/Platforms/MacCatalyst/AppDelegate.cs index 8ed035bf..45ddaa37 100644 --- a/samples/CommunityToolkit.Maui.Markup.Sample/Platforms/MacCatalyst/AppDelegate.cs +++ b/samples/CommunityToolkit.Maui.Markup.Sample/Platforms/MacCatalyst/AppDelegate.cs @@ -1,9 +1,7 @@ -using System.Diagnostics.CodeAnalysis; -using Foundation; +using Foundation; namespace CommunityToolkit.Maui.Markup.Sample; [Register(nameof(AppDelegate))] -[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")] public class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/Platforms/iOS/AppDelegate.cs b/samples/CommunityToolkit.Maui.Markup.Sample/Platforms/iOS/AppDelegate.cs index 8ed035bf..45ddaa37 100644 --- a/samples/CommunityToolkit.Maui.Markup.Sample/Platforms/iOS/AppDelegate.cs +++ b/samples/CommunityToolkit.Maui.Markup.Sample/Platforms/iOS/AppDelegate.cs @@ -1,9 +1,7 @@ -using System.Diagnostics.CodeAnalysis; -using Foundation; +using Foundation; namespace CommunityToolkit.Maui.Markup.Sample; [Register(nameof(AppDelegate))] -[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")] public class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectExtensionsTests.cs index c1d1f6a2..2d6f5287 100644 --- a/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectExtensionsTests.cs +++ b/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectExtensionsTests.cs @@ -1,5 +1,4 @@ using System.Windows.Input; -using BindableObjectViews; using CommunityToolkit.Maui.Markup.UnitTests.Base; using NUnit.Framework; namespace CommunityToolkit.Maui.Markup.UnitTests @@ -672,40 +671,40 @@ public void BindDefaultPropertyWithInlineTwoWayParameterizedConvertAndPositional [Test] public void BindCommandWithDefaults() { - var textCell = new TextCell(); + var button = new Button(); var path = nameof(viewModel.Command); - textCell.BindCommand(path); + button.BindCommand(path); - BindingHelpers.AssertBindingExists(textCell, TextCell.CommandProperty, path); - BindingHelpers.AssertBindingExists(textCell, TextCell.CommandParameterProperty); + BindingHelpers.AssertBindingExists(button, Button.CommandProperty, path); + BindingHelpers.AssertBindingExists(button, Button.CommandParameterProperty); } [Test] public void BindCommandWithoutParameter() { - var textCell = new TextCell(); + var button = new Button(); var path = nameof(viewModel.Command); - textCell.BindCommand(path, parameterPath: null); + button.BindCommand(path, parameterPath: null); - BindingHelpers.AssertBindingExists(textCell, TextCell.CommandProperty, path); - Assert.That(BindingHelpers.GetBinding(textCell, TextCell.CommandParameterProperty), Is.Null); + BindingHelpers.AssertBindingExists(button, Button.CommandProperty, path); + Assert.That(BindingHelpers.GetBinding(button, Button.CommandParameterProperty), Is.Null); } [Test] public void BindCommandWithPositionalParameters() { - var textCell = new TextCell(); + var button = new Button(); object source = new ViewModel(); var path = nameof(viewModel.Command); var parameterPath = nameof(viewModel.Id); object parameterSource = new ViewModel(); - textCell.BindCommand(path, source, parameterPath, parameterSource); + button.BindCommand(path, source, parameterPath, parameterSource); - BindingHelpers.AssertBindingExists(textCell, TextCell.CommandProperty, path, source: source); - BindingHelpers.AssertBindingExists(textCell, TextCell.CommandParameterProperty, parameterPath, source: parameterSource); + BindingHelpers.AssertBindingExists(button, Button.CommandProperty, path, source: source); + BindingHelpers.AssertBindingExists(button, Button.CommandParameterProperty, parameterPath, source: parameterSource); } [Test] @@ -747,7 +746,6 @@ public void SupportDerivedElements() .Assign(out DerivedFromLabel assignDerivedFromLabel), Is.InstanceOf()); - Assert.That(new DerivedFromTextCell().BindCommand(nameof(viewModel.Command)), Is.InstanceOf()); Assert.That(assignDerivedFromLabel, Is.InstanceOf()); }); } @@ -803,8 +801,4 @@ sealed class ViewModel class DerivedFromLabel : Label { } - - class DerivedFromTextCell : TextCell - { - } } \ No newline at end of file diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/CommunityToolkit.Maui.Markup.UnitTests.csproj b/src/CommunityToolkit.Maui.Markup.UnitTests/CommunityToolkit.Maui.Markup.UnitTests.csproj index 8cd86c80..d4ca0d56 100644 --- a/src/CommunityToolkit.Maui.Markup.UnitTests/CommunityToolkit.Maui.Markup.UnitTests.csproj +++ b/src/CommunityToolkit.Maui.Markup.UnitTests/CommunityToolkit.Maui.Markup.UnitTests.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/DynamicResourceHandlerTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/DynamicResourceHandlerTests.cs index 3129c81a..8b47803f 100644 --- a/src/CommunityToolkit.Maui.Markup.UnitTests/DynamicResourceHandlerTests.cs +++ b/src/CommunityToolkit.Maui.Markup.UnitTests/DynamicResourceHandlerTests.cs @@ -1,5 +1,4 @@ using CommunityToolkit.Maui.Markup.UnitTests.Base; -using CommunityToolkit.Maui.Markup.UnitTests.Mocks; using NUnit.Framework; namespace CommunityToolkit.Maui.Markup.UnitTests; diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs index dbd8bf79..bf2e1833 100644 --- a/src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs +++ b/src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs @@ -1,5 +1,4 @@ using CommunityToolkit.Maui.Markup.UnitTests.Base; -using CommunityToolkit.Maui.Markup.UnitTests.Mocks; using NUnit.Framework; namespace CommunityToolkit.Maui.Markup.UnitTests; diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs index ae750fbd..d5988a09 100644 --- a/src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs +++ b/src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs @@ -51,15 +51,15 @@ public void BindCommandThrowsArgumentNullExceptionWhenParameterHandlersNull() [Test] public void BindCommandWithDefaults() { - var textCell = new TextCell + var button = new Button { BindingContext = viewModel }; - textCell.BindCommand(static (ViewModel vm) => vm.Command); + button.BindCommand(static (ViewModel vm) => vm.Command); - BindingHelpers.AssertTypedBindingExists(textCell, TextCell.CommandProperty, BindingMode.Default, viewModel); - Assert.That(BindingHelpers.GetBinding(textCell, TextCell.CommandParameterProperty), Is.Null); + BindingHelpers.AssertTypedBindingExists(button, Button.CommandProperty, BindingMode.Default, viewModel); + Assert.That(BindingHelpers.GetBinding(button, Button.CommandParameterProperty), Is.Null); } [Test] @@ -67,24 +67,24 @@ public void BindCommandWithParameters() { ArgumentNullException.ThrowIfNull(viewModel); - var textCell = new TextCell + var button = new Button { BindingContext = viewModel }; - textCell.BindCommand( + button.BindCommand( static (ViewModel vm) => vm.Command, commandBindingMode: BindingMode.OneTime, parameterGetter: static (ViewModel vm) => vm.Id, parameterBindingMode: BindingMode.OneWay); - BindingHelpers.AssertTypedBindingExists(textCell, TextCell.CommandProperty, BindingMode.OneTime, viewModel); - BindingHelpers.AssertTypedBindingExists(textCell, TextCell.CommandParameterProperty, BindingMode.OneWay, viewModel); + BindingHelpers.AssertTypedBindingExists(button, Button.CommandProperty, BindingMode.OneTime, viewModel); + BindingHelpers.AssertTypedBindingExists(button, Button.CommandParameterProperty, BindingMode.OneWay, viewModel); Assert.Multiple(() => { - Assert.That(viewModel.Command, Is.EqualTo(textCell.Command)); - Assert.That(viewModel.Id, Is.EqualTo(textCell.CommandParameter)); + Assert.That(viewModel.Command, Is.EqualTo(button.Command)); + Assert.That(viewModel.Id, Is.EqualTo(button.CommandParameter)); }); } @@ -778,4 +778,4 @@ public NestedViewModel? Model set => SetProperty(ref field, value); } } -} \ No newline at end of file +} diff --git a/src/CommunityToolkit.Maui.Markup.sln b/src/CommunityToolkit.Maui.Markup.sln deleted file mode 100644 index 044c1144..00000000 --- a/src/CommunityToolkit.Maui.Markup.sln +++ /dev/null @@ -1,50 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31512.422 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.Markup", "CommunityToolkit.Maui.Markup\CommunityToolkit.Maui.Markup.csproj", "{329C6136-9A8E-4E46-93E1-930CC032D073}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.Markup.UnitTests", "CommunityToolkit.Maui.Markup.UnitTests\CommunityToolkit.Maui.Markup.UnitTests.csproj", "{480F4FB8-F50A-4349-B5B6-C4D6D9151343}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{478D53B4-48B3-4100-BF4D-60F3FC77DE81}" - ProjectSection(SolutionItems) = preProject - ..\.editorconfig = ..\.editorconfig - ..\Directory.Build.props = ..\Directory.Build.props - ..\global.json = ..\global.json - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Maui.Markup.SourceGenerators", "CommunityToolkit.Maui.Markup.SourceGenerators\CommunityToolkit.Maui.Markup.SourceGenerators.csproj", "{C66CEA39-565E-479C-974D-72795D3502CB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Maui.Markup.Benchmarks", "CommunityToolkit.Maui.Markup.Benchmarks\CommunityToolkit.Maui.Markup.Benchmarks.csproj", "{9A46B6CE-CC4B-4F26-80F8-779C94A88C18}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {329C6136-9A8E-4E46-93E1-930CC032D073}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {329C6136-9A8E-4E46-93E1-930CC032D073}.Debug|Any CPU.Build.0 = Debug|Any CPU - {329C6136-9A8E-4E46-93E1-930CC032D073}.Release|Any CPU.ActiveCfg = Release|Any CPU - {329C6136-9A8E-4E46-93E1-930CC032D073}.Release|Any CPU.Build.0 = Release|Any CPU - {480F4FB8-F50A-4349-B5B6-C4D6D9151343}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {480F4FB8-F50A-4349-B5B6-C4D6D9151343}.Debug|Any CPU.Build.0 = Debug|Any CPU - {480F4FB8-F50A-4349-B5B6-C4D6D9151343}.Release|Any CPU.ActiveCfg = Release|Any CPU - {480F4FB8-F50A-4349-B5B6-C4D6D9151343}.Release|Any CPU.Build.0 = Release|Any CPU - {C66CEA39-565E-479C-974D-72795D3502CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C66CEA39-565E-479C-974D-72795D3502CB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C66CEA39-565E-479C-974D-72795D3502CB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C66CEA39-565E-479C-974D-72795D3502CB}.Release|Any CPU.Build.0 = Release|Any CPU - {9A46B6CE-CC4B-4F26-80F8-779C94A88C18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A46B6CE-CC4B-4F26-80F8-779C94A88C18}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A46B6CE-CC4B-4F26-80F8-779C94A88C18}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A46B6CE-CC4B-4F26-80F8-779C94A88C18}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {42B065EB-DA54-40BE-B676-3D47D59A81F2} - EndGlobalSection -EndGlobal diff --git a/src/CommunityToolkit.Maui.Markup.slnx b/src/CommunityToolkit.Maui.Markup.slnx new file mode 100644 index 00000000..d222d918 --- /dev/null +++ b/src/CommunityToolkit.Maui.Markup.slnx @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj b/src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj index 0290633e..085469fe 100644 --- a/src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj +++ b/src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj @@ -56,7 +56,7 @@ - + diff --git a/src/CommunityToolkit.Maui.Markup/DefaultBindableProperties.cs b/src/CommunityToolkit.Maui.Markup/DefaultBindableProperties.cs index b3a79554..53cd26da 100644 --- a/src/CommunityToolkit.Maui.Markup/DefaultBindableProperties.cs +++ b/src/CommunityToolkit.Maui.Markup/DefaultBindableProperties.cs @@ -15,11 +15,7 @@ public static class DefaultBindableProperties { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Border)}", Border.ContentProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(BoxView)}", BoxView.ColorProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Button)}", Button.CommandProperty }, - { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(CarouselPage)}", Page.TitleProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(CheckBox)}", CheckBox.IsCheckedProperty }, -#pragma warning disable CS0618 - { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ClickGestureRecognizer)}", ClickGestureRecognizer.CommandProperty }, -#pragma warning disable CS0618 { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(CollectionView)}", CollectionView.ItemsSourceProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ContentPage)}", Page.TitleProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ContentPresenter)}", ContentPresenter.ContentProperty }, @@ -27,19 +23,27 @@ public static class DefaultBindableProperties { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(DatePicker)}", DatePicker.DateProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Editor)}", Editor.TextProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Entry)}", Entry.TextProperty }, +#pragma warning disable CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(EntryCell)}", EntryCell.TextProperty }, +#pragma warning restore CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(FileImageSource)}", FileImageSource.FileProperty }, +#pragma warning disable CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Frame)}", Frame.ContentProperty }, +#pragma warning restore CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(FlyoutPage)}", FlyoutPage.IsPresentedProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(GraphicsView)}", GraphicsView.DrawableProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(HtmlWebViewSource)}", HtmlWebViewSource.HtmlProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Image)}", Image.SourceProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ImageButton)}", ImageButton.CommandProperty }, +#pragma warning disable CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ImageCell)}", ImageCell.ImageSourceProperty }, +#pragma warning restore CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(IndicatorView)}", IndicatorView.ItemsSourceProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ItemsView)}", ItemsView.ItemsSourceProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Label)}", Label.TextProperty }, +#pragma warning disable CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ListView)}", ListView.ItemsSourceProperty }, +#pragma warning restore CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(MenuFlyoutItem)}", MenuFlyoutItem.TextProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(MenuFlyoutSubItem)}", MenuFlyoutSubItem.TextProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(MenuItem)}", MenuItem.TextProperty }, @@ -65,14 +69,18 @@ public static class DefaultBindableProperties { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Switch)}", Switch.IsToggledProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(SwipeItemView)}", SwipeItemView.ContentProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(SwipeView)}", SwipeView.ContentProperty }, +#pragma warning disable CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(SwitchCell)}", SwitchCell.OnProperty }, +#pragma warning restore CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TabbedPage)}", Page.TitleProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TableRoot)}", TableRoot.TitleProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TableSection)}", TableSection.TitleProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TableSectionBase)}", TableSectionBase.TitleProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TapGestureRecognizer)}", TapGestureRecognizer.CommandProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TemplatedPage)}", Page.TitleProperty }, +#pragma warning disable CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TextCell)}", TextCell.TextProperty }, +#pragma warning restore CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TemplatedView)}", TemplatedView.ControlTemplateProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TimePicker)}", TimePicker.TimeProperty }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ToolbarItem)}", ToolbarItem.CommandProperty }, @@ -85,10 +93,9 @@ public static class DefaultBindableProperties static readonly Dictionary bindableObjectTypeDefaultCommandAndParameterProperties = new() { // Key: full type name of BindableObject, Value: command property and corresponding commandParameter property { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(Button)}", (Button.CommandProperty, Button.CommandParameterProperty) }, +#pragma warning disable CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(TextCell)}", (TextCell.CommandProperty, TextCell.CommandParameterProperty) }, -#pragma warning disable CS0618 - { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ClickGestureRecognizer)}", (ClickGestureRecognizer.CommandProperty, ClickGestureRecognizer.CommandParameterProperty) }, -#pragma warning restore CS0618 +#pragma warning restore CS0618 // Type or member is obsolete { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(ImageButton)}", (ImageButton.CommandProperty, ImageButton.CommandParameterProperty) }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(MenuItem)}", (MenuItem.CommandProperty, MenuItem.CommandParameterProperty) }, { $"{nameof(Microsoft)}.{nameof(Microsoft.Maui)}.{nameof(Microsoft.Maui.Controls)}.{nameof(RefreshView)}", (RefreshView.CommandProperty, RefreshView.CommandParameterProperty) },