diff --git a/.github/workflows/build_avalonia.yml b/.github/workflows/build_avalonia.yml index a12254c8f6..a763e9556a 100644 --- a/.github/workflows/build_avalonia.yml +++ b/.github/workflows/build_avalonia.yml @@ -23,3 +23,4 @@ jobs: with: name: Build Prism.Avalonia solution-path: PrismLibrary_Avalonia.slnf + dotnet-version: 10.0.100 diff --git a/.github/workflows/build_core.yml b/.github/workflows/build_core.yml index 6facbfa901..40fad7178b 100644 --- a/.github/workflows/build_core.yml +++ b/.github/workflows/build_core.yml @@ -21,3 +21,4 @@ jobs: with: name: Build Prism.Core solution-path: PrismLibrary_Core.slnf + dotnet-version: 10.0.100 diff --git a/.github/workflows/build_maui.yml b/.github/workflows/build_maui.yml index 80725015ac..f7e8e6b6f6 100644 --- a/.github/workflows/build_maui.yml +++ b/.github/workflows/build_maui.yml @@ -25,3 +25,4 @@ jobs: name: Build Prism.Maui solution-path: PrismLibrary_Maui.slnf install-workload: maui maui-tizen + dotnet-version: 10.0.100 diff --git a/.github/workflows/build_uno.yml b/.github/workflows/build_uno.yml index 8fd3baae04..ef2de1b4d6 100644 --- a/.github/workflows/build_uno.yml +++ b/.github/workflows/build_uno.yml @@ -26,9 +26,9 @@ jobs: name: Build Prism.Uno solution-path: PrismLibrary_Uno.slnf windows-sdk-version: 18362 - dotnet-version: 8.0.300 - install-workload: ios android macos maccatalyst wasm-tools + dotnet-version: 10.0.100 + install-workload: ios android macos maccatalyst wasm-tools tvos uno-check: false - uno-check-version: 1.25.1 + uno-check-version: 1.33.1 uno-check-parameters: '--skip xcode --skip gtk3 --skip vswin --skip androidemulator --skip androidsdk --skip vsmac --skip dotnetnewunotemplates' run-tests: false diff --git a/.github/workflows/build_wpf.yml b/.github/workflows/build_wpf.yml index 6da41c003b..78b7d06b83 100644 --- a/.github/workflows/build_wpf.yml +++ b/.github/workflows/build_wpf.yml @@ -23,3 +23,4 @@ jobs: with: name: Build Prism.Wpf solution-path: PrismLibrary_Wpf.slnf + dotnet-version: 10.0.100 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d689bdc937..6adc1e5848 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,9 @@ jobs: with: name: Build Prism.Core solution-path: PrismLibrary_Core.slnf - code-sign: true + code-sign: false artifact-name: Core + dotnet-version: 10.0.100 secrets: codeSignKeyVault: ${{ secrets.CodeSignKeyVault }} codeSignClientId: ${{ secrets.CodeSignClientId }} @@ -43,8 +44,9 @@ jobs: with: name: Build Prism.Wpf solution-path: PrismLibrary_Wpf.slnf - code-sign: true + code-sign: false artifact-name: Wpf + dotnet-version: 10.0.100 secrets: codeSignKeyVault: ${{ secrets.CodeSignKeyVault }} codeSignClientId: ${{ secrets.CodeSignClientId }} @@ -58,13 +60,13 @@ jobs: name: Build Prism.Uno solution-path: PrismLibrary_Uno.slnf windows-sdk-version: 18362 - dotnet-version: 8.0.300 - install-workload: ios android macos maccatalyst wasm-tools + dotnet-version: 10.0.100 + install-workload: ios android macos maccatalyst wasm-tools tvos uno-check: false - uno-check-version: 1.24.0 + uno-check-version: 1.33.1 uno-check-parameters: '--skip xcode --skip gtk3 --skip vswin --skip androidemulator --skip androidsdk --skip vsmac --skip dotnetnewunotemplates' run-tests: false - code-sign: true + code-sign: false artifact-name: Uno secrets: codeSignKeyVault: ${{ secrets.CodeSignKeyVault }} @@ -79,8 +81,9 @@ jobs: name: Build Prism.Maui solution-path: PrismLibrary_Maui.slnf install-workload: maui maui-tizen - code-sign: true + code-sign: false artifact-name: Maui + dotnet-version: 10.0.100 secrets: codeSignKeyVault: ${{ secrets.CodeSignKeyVault }} codeSignClientId: ${{ secrets.CodeSignClientId }} @@ -93,8 +96,9 @@ jobs: with: name: Build Prism.Avalonia solution-path: PrismLibrary_Avalonia.slnf - code-sign: true + code-sign: false artifact-name: Avalonia + dotnet-version: 10.0.100 secrets: codeSignKeyVault: ${{ secrets.CodeSignKeyVault }} codeSignClientId: ${{ secrets.CodeSignClientId }} @@ -167,4 +171,4 @@ jobs: name: Deploy Commercial Plus secrets: feedUrl: ${{ secrets.PRISM_NUGET_FEED }} - apiKey: ${{ secrets.PRISM_NUGET_TOKEN }} \ No newline at end of file + apiKey: ${{ secrets.PRISM_NUGET_TOKEN }} diff --git a/Directory.Packages.props b/Directory.Packages.props index d8264df734..7c2576ce29 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,10 +10,13 @@ - - + - - + + - - + + - + - - - - - + + + + + - - + + - - - - + + + + - - + + + - - - - - - - - - + + + + + + + + + @@ -96,7 +100,7 @@ - + diff --git a/e2e/Avalonia/PrismAvaloniaDemo/PrismAvaloniaDemo.csproj b/e2e/Avalonia/PrismAvaloniaDemo/PrismAvaloniaDemo.csproj index b90410dc08..6c0c67e5d3 100644 --- a/e2e/Avalonia/PrismAvaloniaDemo/PrismAvaloniaDemo.csproj +++ b/e2e/Avalonia/PrismAvaloniaDemo/PrismAvaloniaDemo.csproj @@ -1,7 +1,7 @@  WinExe - net8.0 + net10.0 latest enable true diff --git a/e2e/Maui/MauiModule/MauiModule.csproj b/e2e/Maui/MauiModule/MauiModule.csproj index 17eebbf71a..e8703f975a 100644 --- a/e2e/Maui/MauiModule/MauiModule.csproj +++ b/e2e/Maui/MauiModule/MauiModule.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 false true diff --git a/e2e/Maui/MauiRegionsModule/MauiRegionsModule.csproj b/e2e/Maui/MauiRegionsModule/MauiRegionsModule.csproj index 17eebbf71a..e8703f975a 100644 --- a/e2e/Maui/MauiRegionsModule/MauiRegionsModule.csproj +++ b/e2e/Maui/MauiRegionsModule/MauiRegionsModule.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 false true diff --git a/e2e/Maui/PrismMauiDemo/PrismMauiDemo.csproj b/e2e/Maui/PrismMauiDemo/PrismMauiDemo.csproj index 4226d9a8ae..ae57a6971d 100644 --- a/e2e/Maui/PrismMauiDemo/PrismMauiDemo.csproj +++ b/e2e/Maui/PrismMauiDemo/PrismMauiDemo.csproj @@ -1,8 +1,8 @@ - net8.0-android;net8.0-ios;net8.0-maccatalyst - $(TargetFrameworks);net8.0-windows10.0.19041 + net10.0-android;net10.0-ios;net10.0-maccatalyst + $(TargetFrameworks);net10.0-windows10.0.19041 Exe PrismMauiDemo true diff --git a/e2e/Uno/Directory.Build.props b/e2e/Uno/Directory.Build.props index a0276367b3..7bda23a255 100644 --- a/e2e/Uno/Directory.Build.props +++ b/e2e/Uno/Directory.Build.props @@ -1,6 +1,6 @@ - net8.0 + net10.0 enable enable true diff --git a/e2e/Wpf/HelloWorld.Bootstraper/HelloWorld.Bootstrapper.csproj b/e2e/Wpf/HelloWorld.Bootstraper/HelloWorld.Bootstrapper.csproj index 10de18462f..e22f854e88 100644 --- a/e2e/Wpf/HelloWorld.Bootstraper/HelloWorld.Bootstrapper.csproj +++ b/e2e/Wpf/HelloWorld.Bootstraper/HelloWorld.Bootstrapper.csproj @@ -2,7 +2,7 @@ WinExe - net6.0-windows;net462 + net10.0-windows;net462 true HelloWorld ..\HelloWorld\prism-sandbox.ico diff --git a/e2e/Wpf/HelloWorld.Core/HelloWorld.Core.csproj b/e2e/Wpf/HelloWorld.Core/HelloWorld.Core.csproj index d5749ef11f..a9ca4f3093 100644 --- a/e2e/Wpf/HelloWorld.Core/HelloWorld.Core.csproj +++ b/e2e/Wpf/HelloWorld.Core/HelloWorld.Core.csproj @@ -1,7 +1,7 @@  - net6.0-windows;net462 + net10.0-windows;net462 true diff --git a/e2e/Wpf/HelloWorld/HelloWorld.csproj b/e2e/Wpf/HelloWorld/HelloWorld.csproj index da5afa4048..3bfd58d1c1 100644 --- a/e2e/Wpf/HelloWorld/HelloWorld.csproj +++ b/e2e/Wpf/HelloWorld/HelloWorld.csproj @@ -2,7 +2,7 @@ WinExe - net6.0-windows;net462 + net10.0-windows;net462 true HelloWorld HelloWorld diff --git a/e2e/Wpf/Modules/HelloWorld.Modules.ModuleA/HelloWorld.Modules.ModuleA.csproj b/e2e/Wpf/Modules/HelloWorld.Modules.ModuleA/HelloWorld.Modules.ModuleA.csproj index 67471f38fd..8fb3629763 100644 --- a/e2e/Wpf/Modules/HelloWorld.Modules.ModuleA/HelloWorld.Modules.ModuleA.csproj +++ b/e2e/Wpf/Modules/HelloWorld.Modules.ModuleA/HelloWorld.Modules.ModuleA.csproj @@ -1,7 +1,7 @@  - net6.0-windows;net462 + net10.0-windows;net462 true diff --git a/global.json b/global.json index b5b460407f..d4a3f1e307 100644 --- a/global.json +++ b/global.json @@ -2,6 +2,6 @@ "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.56", "MSBuild.Sdk.Extras": "3.0.44", - "Uno.Sdk": "5.3.31" + "Uno.Sdk": "6.4.20" } } diff --git a/src/Avalonia/Prism.Avalonia/Prism.Avalonia.csproj b/src/Avalonia/Prism.Avalonia/Prism.Avalonia.csproj index 5ada70059d..33ef49d356 100644 --- a/src/Avalonia/Prism.Avalonia/Prism.Avalonia.csproj +++ b/src/Avalonia/Prism.Avalonia/Prism.Avalonia.csproj @@ -3,7 +3,7 @@ Properties Prism - net6.0;net7.0;net8.0 + net9.0;net10.0 Prism.Avalonia is a fully open source version of the Prism guidance originally produced by Microsoft Patterns & Practices. Prism.Avalonia provides an implementation of a collection of design patterns that are helpful in writing well structured, maintainable, and testable XAML applications, including MVVM, dependency injection, commanding, event aggregation, and more. Prism's core functionality is a shared library targeting the .NET Framework and .NET Standard. Features that need to be platform specific are implemented in the respective libraries for the target platform (Avalonia, WPF, Uno Platform, and Xamarin Forms). Prism.Avalonia helps you more easily design and build rich, flexible, and easy to maintain cross-platform Avalonia desktop applications. This library provides user interface composition as well as modularity support. @@ -11,11 +11,11 @@ Prism.Avalonia helps you more easily design and build rich, flexible, and easy t Prism.Avalonia - + @@ -37,7 +37,7 @@ Prism.Avalonia helps you more easily design and build rich, flexible, and easy t - + diff --git a/src/Avalonia/Prism.DryIoc.Avalonia/Prism.DryIoc.Avalonia.csproj b/src/Avalonia/Prism.DryIoc.Avalonia/Prism.DryIoc.Avalonia.csproj index 2f6b60c4a7..259e672f21 100644 --- a/src/Avalonia/Prism.DryIoc.Avalonia/Prism.DryIoc.Avalonia.csproj +++ b/src/Avalonia/Prism.DryIoc.Avalonia/Prism.DryIoc.Avalonia.csproj @@ -2,10 +2,8 @@ Prism.DryIoc - net6.0;net7.0;net8.0 + net9.0;net10.0 This extension is used to build Prism.Avalonia applications based on DryIoc. Users must install the Prism.Avalonia NuGet package as well. - Damian Suess, Suess Labs, various contributors - Copyright (c) 2024 Xeno Innovations, Inc. Prism.DryIoc.Avalonia README.md prism;mvvm;xaml;avalonia;dryioc;dependencyinjection;navigation;dialog;prismavalonia; diff --git a/src/Directory.Build.props b/src/Directory.Build.props index b43e833fa0..614dc79a49 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -25,8 +25,9 @@ - net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-macos - $(UnoTargetFrameworks);net8.0-windows10.0.19041 + net9.0;net9.0-android;net9.0-ios;net9.0-tvos;net9.0-desktop;net9.0-browserwasm + $(UnoTargetFrameworks);net10.0;net10.0-android;net10.0-ios;net10.0-tvos;net10.0-desktop;net10.0-browserwasm + $(UnoTargetFrameworks);net9.0-windows10.0.19041;net10.0-windows10.0.19041 win-x64;win-x86;win-arm64 diff --git a/src/Maui/Prism.DryIoc.Maui/Prism.DryIoc.Maui.csproj b/src/Maui/Prism.DryIoc.Maui/Prism.DryIoc.Maui.csproj index 46086e22f1..23aabe563b 100644 --- a/src/Maui/Prism.DryIoc.Maui/Prism.DryIoc.Maui.csproj +++ b/src/Maui/Prism.DryIoc.Maui/Prism.DryIoc.Maui.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0;net10.0 true true true @@ -10,11 +10,23 @@ - + + + + + + + + + + + + + diff --git a/src/Maui/Prism.Maui.Rx/Prism.Maui.Rx.csproj b/src/Maui/Prism.Maui.Rx/Prism.Maui.Rx.csproj index 1685fe7734..d56781bbc2 100644 --- a/src/Maui/Prism.Maui.Rx/Prism.Maui.Rx.csproj +++ b/src/Maui/Prism.Maui.Rx/Prism.Maui.Rx.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0;net10.0 true Prism.Maui.Rx is a support package for .NET MAUI developers. This package provides some helpers to access an IObservable for globally handling Navigation Request Results. true @@ -13,8 +13,20 @@ - + + + + + + + + + + + + + diff --git a/src/Maui/Prism.Maui/Dialogs/Xaml/ShowDialogExtension.cs b/src/Maui/Prism.Maui/Dialogs/Xaml/ShowDialogExtension.cs index 16ff6133d4..2f12cb1729 100644 --- a/src/Maui/Prism.Maui/Dialogs/Xaml/ShowDialogExtension.cs +++ b/src/Maui/Prism.Maui/Dialogs/Xaml/ShowDialogExtension.cs @@ -1,4 +1,4 @@ -using System.Windows.Input; +using System.Windows.Input; using Microsoft.Extensions.Logging; using Prism.Ioc; using Prism.Navigation.Xaml; @@ -7,6 +7,7 @@ namespace Prism.Dialogs.Xaml; [ContentProperty(nameof(Name))] +[RequireService([typeof(IProvideValueTarget)])] public class ShowDialogExtension : TargetAwareExtensionBase, ICommand { public static readonly BindableProperty NameProperty = diff --git a/src/Maui/Prism.Maui/Navigation/Regions/Xaml/RegionManager.cs b/src/Maui/Prism.Maui/Navigation/Regions/Xaml/RegionManager.cs index 7675c562f2..83bb840c59 100644 --- a/src/Maui/Prism.Maui/Navigation/Regions/Xaml/RegionManager.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Xaml/RegionManager.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using System.Reflection; using Prism.Common; using Prism.Events; @@ -14,7 +14,7 @@ namespace Prism.Navigation.Regions.Xaml; /// public static class RegionManager { - private static readonly WeakDelegatesManager updatingRegionsListeners = new WeakDelegatesManager(); + private static readonly WeakDelegatesManager updatingRegionsListeners = new (); private static readonly BindableProperty ObservableRegionProperty = BindableProperty.CreateAttached("ObservableRegion", typeof(ObservableObject), typeof(RegionManager), null); @@ -53,12 +53,29 @@ public static class RegionManager public static readonly BindableProperty RegionContextProperty = BindableProperty.CreateAttached("RegionContext", typeof(object), typeof(RegionManager), null, propertyChanged: OnRegionContextChanged); + /// + /// Sets the default view to be displayed in a region when it is created. + /// public static readonly BindableProperty DefaultViewProperty = BindableProperty.CreateAttached("DefaultView", typeof(object), typeof(RegionManager), null); + /// + /// Sets the attached property for the specified region target. + /// + /// The that will host the default view. + /// + /// The default view to display in the region. This can be a view name, a type, or an instance of the view. + /// public static void SetDefaultView(VisualElement regionTarget, object viewNameTypeOrInstance) => regionTarget.SetValue(DefaultViewProperty, viewNameTypeOrInstance); + /// + /// Gets the value of the attached property for the specified region target. + /// + /// The that hosts the default view. + /// + /// The default view associated with the region. This can be a view name, a type, or an instance of the view. + /// public static object GetDefaultView(VisualElement regionTarget) => regionTarget.GetValue(DefaultViewProperty); diff --git a/src/Maui/Prism.Maui/Navigation/Xaml/GoBackExtension.cs b/src/Maui/Prism.Maui/Navigation/Xaml/GoBackExtension.cs index 8da35f53f8..884155a215 100644 --- a/src/Maui/Prism.Maui/Navigation/Xaml/GoBackExtension.cs +++ b/src/Maui/Prism.Maui/Navigation/Xaml/GoBackExtension.cs @@ -1,8 +1,9 @@ - + namespace Prism.Navigation.Xaml; [ContentProperty(nameof(GoBackType))] -public class GoBackExtension : NavigationExtensionBase +[RequireService([typeof(IProvideValueTarget)])] +public partial class GoBackExtension : NavigationExtensionBase { public static readonly BindableProperty GoBackTypeProperty = BindableProperty.Create(nameof(GoBackType), typeof(GoBackType), typeof(GoBackExtension), GoBackType.Default); diff --git a/src/Maui/Prism.Maui/Navigation/Xaml/GoBackType.cs b/src/Maui/Prism.Maui/Navigation/Xaml/GoBackType.cs index faf39dc9a1..e4a7ff12ed 100644 --- a/src/Maui/Prism.Maui/Navigation/Xaml/GoBackType.cs +++ b/src/Maui/Prism.Maui/Navigation/Xaml/GoBackType.cs @@ -1,8 +1,17 @@ - namespace Prism.Navigation.Xaml; +/// +/// Specifies the type of navigation to perform when going back in the navigation stack. +/// public enum GoBackType { + /// + /// Performs the default go back operation, navigating to the previous page in the stack. + /// Default = 0, + + /// + /// Navigates back to the root page of the navigation stack. + /// ToRoot = 1 } diff --git a/src/Maui/Prism.Maui/Navigation/Xaml/NavigateToExtension.cs b/src/Maui/Prism.Maui/Navigation/Xaml/NavigateToExtension.cs index 3a143c7e64..877b182ae1 100644 --- a/src/Maui/Prism.Maui/Navigation/Xaml/NavigateToExtension.cs +++ b/src/Maui/Prism.Maui/Navigation/Xaml/NavigateToExtension.cs @@ -1,18 +1,30 @@ - +using Microsoft.Extensions.Logging; + namespace Prism.Navigation.Xaml; +/// +/// A markup extension that enables navigation to a specified page by name using Prism's navigation service. +/// [ContentProperty(nameof(Name))] -public class NavigateToExtension : NavigationExtensionBase +[RequireService([typeof(IProvideValueTarget)])] +public partial class NavigateToExtension : NavigationExtensionBase { + /// + /// Identifies the bindable property. + /// public static readonly BindableProperty NameProperty = BindableProperty.Create(nameof(Name), typeof(string), typeof(NavigateToExtension), null); + /// + /// Gets or sets the name of the page to navigate to. + /// public string Name { get => (string)GetValue(NameProperty); set => SetValue(NameProperty, value); } + /// protected override async Task HandleNavigation(INavigationParameters parameters, INavigationService navigationService) { AddKnownNavigationParameters(parameters); @@ -24,8 +36,12 @@ protected override async Task HandleNavigation(INavigationParameters parameters, } } + /// protected override void Log(Exception ex, INavigationParameters parameters) { - // TODO: Determine a good way to log + if (Logger.IsEnabled(LogLevel.Error)) + { + Logger.LogError(ex, "Navigation to {PageName} failed with parameters: {Parameters}", Name, parameters); + } } } diff --git a/src/Maui/Prism.Maui/Navigation/Xaml/NavigationExtensionBase.cs b/src/Maui/Prism.Maui/Navigation/Xaml/NavigationExtensionBase.cs index 3aa5ed9bc6..75c5817f58 100644 --- a/src/Maui/Prism.Maui/Navigation/Xaml/NavigationExtensionBase.cs +++ b/src/Maui/Prism.Maui/Navigation/Xaml/NavigationExtensionBase.cs @@ -5,32 +5,60 @@ namespace Prism.Navigation.Xaml; +/// +/// Provides a base class for navigation extensions in XAML, implementing for navigation actions. +/// public abstract class NavigationExtensionBase : TargetAwareExtensionBase, ICommand { + /// + /// Identifies the bindable property. + /// public static readonly BindableProperty AnimatedProperty = BindableProperty.Create(nameof(Animated), typeof(bool), typeof(NavigationExtensionBase), true); + /// + /// Identifies the bindable property. + /// public static readonly BindableProperty UseModalNavigationProperty = BindableProperty.Create(nameof(UseModalNavigation), typeof(bool?), typeof(NavigationExtensionBase), null); + /// + /// Gets a value indicating whether a navigation operation is currently in progress. + /// protected internal bool IsNavigating { get; private set; } + /// + /// Gets or sets a value indicating whether navigation should be animated. + /// public bool Animated { get => (bool)GetValue(AnimatedProperty); set => SetValue(AnimatedProperty, value); } + /// + /// Gets or sets a value indicating whether modal navigation should be used. + /// public bool? UseModalNavigation { get => (bool?)GetValue(UseModalNavigationProperty); set => SetValue(UseModalNavigationProperty, value); } + /// + /// Determines whether the command can execute in its current state. + /// + /// Data used by the command. If the command does not require data, this object can be set to null. + /// true if the command can execute; otherwise, false. public bool CanExecute(object parameter) => Page is not null && !IsNavigating; + /// public event EventHandler CanExecuteChanged; + /// + /// Executes the navigation command. + /// + /// The navigation parameters. public async void Execute(object parameter) { var parameters = parameter.ToNavigationParameters(TargetElement); @@ -51,19 +79,44 @@ public async void Execute(object parameter) } } + /// + /// Provides the value of the extension, which is the command itself. + /// + /// The service provider. + /// The command instance. protected override ICommand ProvideValue(IServiceProvider serviceProvider) => this; + /// + /// Logs navigation errors. + /// + /// The exception that occurred. + /// The navigation parameters. protected virtual void Log(Exception ex, INavigationParameters parameters) { - // TODO: Determine a good way to log - Logger.LogError(ex, "Error Navigating: \n[exception]"); + if (Logger.IsEnabled(LogLevel.Error)) + { + Logger.LogError(ex, "Error Navigating: \n[exception]"); + } } + /// + /// Handles the navigation logic. Must be implemented by derived classes. + /// + /// The navigation parameters. + /// The navigation service. + /// A task representing the asynchronous operation. protected abstract Task HandleNavigation(INavigationParameters parameters, INavigationService navigationService); + /// + /// Raises the event. + /// protected void RaiseCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty); + /// + /// Adds known navigation parameters such as and to the provided . + /// + /// The navigation parameters to which known values will be added. protected void AddKnownNavigationParameters(INavigationParameters parameters) { parameters.Add(KnownNavigationParameters.Animated, Animated); @@ -72,6 +125,10 @@ protected void AddKnownNavigationParameters(INavigationParameters parameters) parameters.Add(KnownNavigationParameters.UseModalNavigation, UseModalNavigation); } + /// + /// Called when a property value changes. + /// + /// The name of the property that changed. protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); diff --git a/src/Maui/Prism.Maui/Navigation/Xaml/TabbedPage.cs b/src/Maui/Prism.Maui/Navigation/Xaml/TabbedPage.cs index 0c2b35fe31..0f95cf283c 100644 --- a/src/Maui/Prism.Maui/Navigation/Xaml/TabbedPage.cs +++ b/src/Maui/Prism.Maui/Navigation/Xaml/TabbedPage.cs @@ -1,31 +1,88 @@ -namespace Prism.Navigation.Xaml; +namespace Prism.Navigation.Xaml; +/// +/// Provides attached properties for tabbed page navigation and appearance in .NET MAUI applications. +/// public static class TabbedPage { + /// + /// Identifies the TitleBindingSource attached property. + /// Determines the source for the tab title binding. + /// public static BindableProperty TitleBindingSourceProperty = - BindableProperty.CreateAttached("TitleBindingSource", typeof(TabBindingSource), typeof(TabbedPage), TabBindingSource.RootPage); + BindableProperty.CreateAttached( + "TitleBindingSource", + typeof(TabBindingSource), + typeof(TabbedPage), + TabBindingSource.RootPage); + /// + /// Identifies the Title attached property. + /// Sets the title for a tab in a . + /// public static BindableProperty TitleProperty = - BindableProperty.CreateAttached("Title", typeof(string), typeof(TabbedPage), null); + BindableProperty.CreateAttached( + "Title", + typeof(string), + typeof(TabbedPage), + null); + /// + /// Identifies the IconImageSource attached property. + /// Sets the icon image source for a tab in a . + /// public static BindableProperty IconImageSourceProperty = - BindableProperty.CreateAttached("IconImageSource", typeof(ImageSource), typeof(TabbedPage), null); + BindableProperty.CreateAttached( + "IconImageSource", + typeof(ImageSource), + typeof(TabbedPage), + null); + /// + /// Gets the value of the TitleBindingSource attached property from the specified . + /// + /// The page from which to get the property value. + /// The value. public static TabBindingSource GetTitleBindingSource(Page page) => (TabBindingSource)page.GetValue(TitleBindingSourceProperty); + /// + /// Sets the value of the TitleBindingSource attached property on the specified . + /// + /// The page on which to set the property value. + /// The value to set. public static void SetTitleBindingSource(Page page, TabBindingSource bindingSource) => page.SetValue(TitleBindingSourceProperty, bindingSource); + /// + /// Gets the value of the Title attached property from the specified . + /// + /// The page from which to get the property value. + /// The title string. public static string GetTitle(Page page) => (string)page.GetValue(TitleProperty); + /// + /// Sets the value of the Title attached property on the specified . + /// + /// The page on which to set the property value. + /// The title string to set. public static void SetTitle(Page page, string title) => page.SetValue(TitleProperty, title); + /// + /// Gets the value of the IconImageSource attached property from the specified . + /// + /// The page from which to get the property value. + /// The for the tab icon. public static ImageSource GetIconImageSource(Page page) => (ImageSource)page.GetValue(IconImageSourceProperty); + /// + /// Sets the value of the IconImageSource attached property on the specified . + /// + /// The page on which to set the property value. + /// The to set as the tab icon. public static void SetIconImageSource(Page page, ImageSource imageSource) => page.SetValue(IconImageSourceProperty, imageSource); -} \ No newline at end of file +} diff --git a/src/Maui/Prism.Maui/Prism.Maui.csproj b/src/Maui/Prism.Maui/Prism.Maui.csproj index d27c27cc50..b9d1ed0b88 100644 --- a/src/Maui/Prism.Maui/Prism.Maui.csproj +++ b/src/Maui/Prism.Maui/Prism.Maui.csproj @@ -1,8 +1,8 @@ - net8.0;net8.0-android;net8.0-ios; - $(TargetFrameworks);net8.0-windows10.0.19041 + net9.0;net9.0-android;net9.0-ios;net10.0;net10.0-android;net10.0-ios; + $(TargetFrameworks);net9.0-windows10.0.19041;net10.0-windows10.0.19041 Prism provides an implementation of a collection of design patterns that are helpful in writing well structured, maintainable, and testable XAML applications, including MVVM, dependency injection, commanding, event aggregation, and more. Prism's core functionality is a shared library targeting the .NET Framework and .NET. Features that need to be platform specific are implemented in the respective libraries for the target platform (WPF, Uno Platform, .NET MAUI and Xamarin Forms). Prism for .NET MAUI helps you more easily design and build rich, flexible, and easy to maintain .NET MAUI applications. This library provides user interface composition as well as modularity support. @@ -17,9 +17,20 @@ Prism for .NET MAUI helps you more easily design and build rich, flexible, and e - - - + + + + + + + + + + + + + + diff --git a/src/Maui/Prism.Maui/Xaml/TargetAwareExtensionBase.cs b/src/Maui/Prism.Maui/Xaml/TargetAwareExtensionBase.cs index 5861b0bb48..5ae503c0d6 100644 --- a/src/Maui/Prism.Maui/Xaml/TargetAwareExtensionBase.cs +++ b/src/Maui/Prism.Maui/Xaml/TargetAwareExtensionBase.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using Microsoft.Extensions.Logging; using Prism.Behaviors; using Prism.Extensions; @@ -8,12 +8,24 @@ namespace Prism.Xaml; +/// +/// Provides a base class for XAML markup extensions that are aware of their target element and page context. +/// +/// The type of value provided by the markup extension. public abstract class TargetAwareExtensionBase : BindableObject, IMarkupExtension { private ILogger _logger; - public ILogger Logger => _logger ??= GetLogger(); + + /// + /// Gets the instance for logging within the extension. + /// + protected ILogger Logger => _logger ??= GetLogger(); private Page _page; + + /// + /// Gets or sets the that contains the target element. + /// protected internal Page Page { get => _page; @@ -26,6 +38,10 @@ protected internal Page Page } private VisualElement _targetElement; + + /// + /// Gets or sets the target to which the extension is applied. + /// protected internal VisualElement TargetElement { get => _targetElement; @@ -37,13 +53,23 @@ protected internal VisualElement TargetElement } } + /// + /// Gets the associated with the target element. + /// protected IContainerProvider Container => TargetElement.GetContainerProvider(); /// - /// Sets the Target BindingContext strategy + /// Gets or sets the strategy for determining the binding context for the target. /// public TargetBindingContext TargetBindingContext { get; set; } + /// + /// Provides the value for the markup extension. + /// + /// The service provider for the markup extension. + /// The value to set on the property where the extension is applied. + /// Thrown if the service provider does not provide an . + /// Thrown if the target object is not supported. T IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) { var valueTargetProvider = serviceProvider.GetService(); @@ -68,11 +94,25 @@ T IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) return ProvideValue(serviceProvider); } - object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) => + /// + /// Provides the value for the markup extension (non-generic implementation). + /// + /// The service provider for the markup extension. + /// The value to set on the property where the extension is applied. + object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) => ((IMarkupExtension)this).ProvideValue(serviceProvider); + /// + /// When implemented in a derived class, provides the value for the markup extension. + /// + /// The service provider for the markup extension. + /// The value to set on the property where the extension is applied. protected abstract T ProvideValue(IServiceProvider serviceProvider); + /// + /// Gets the instance for the current page context. + /// + /// An instance, or null if the page is not set. private ILogger GetLogger() { if (Page is null) @@ -82,14 +122,18 @@ private ILogger GetLogger() return loggerFactory.CreateLogger(GetType().Name); } + /// + /// Called when a property value changes. + /// + /// The name of the property that changed. protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); - if(propertyName == nameof(TargetElement) || propertyName == nameof(Page)) + if (propertyName == nameof(TargetElement) || propertyName == nameof(Page)) { var source = TargetBindingContext == TargetBindingContext.Element ? TargetElement : Page; - if(source is not null) + if (source is not null) SetBinding(BindingContextProperty, new Binding(nameof(BindingContext), BindingMode.OneWay, source: source)); } } diff --git a/src/Prism.Core/Prism.Core.csproj b/src/Prism.Core/Prism.Core.csproj index 4645786a66..3f60a09227 100644 --- a/src/Prism.Core/Prism.Core.csproj +++ b/src/Prism.Core/Prism.Core.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net462;net47;net6.0 + net462;net47;net8.0;net9.0;net10.0 Prism Prism.Core Prism diff --git a/src/Prism.Events/Prism.Events.csproj b/src/Prism.Events/Prism.Events.csproj index 2411d17913..c71e11f669 100644 --- a/src/Prism.Events/Prism.Events.csproj +++ b/src/Prism.Events/Prism.Events.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net462;net47;net6.0 + net462;net47;net8.0;net9.0;net10.0 Prism.Events is a library that facilitates communication between loosely coupled components in an application. It provides an event aggregator service that allows publishers and subscribers to interact through events without direct references. With multicast publish/subscribe functionality, multiple publishers can raise the same event, and multiple subscribers can listen to it, enabling flexible and efficient communication. diff --git a/src/Uno/Prism.DryIoc.Uno/Prism.DryIoc.Uno.WinUI.csproj b/src/Uno/Prism.DryIoc.Uno/Prism.DryIoc.Uno.WinUI.csproj index 0500408e6a..8357d718da 100644 --- a/src/Uno/Prism.DryIoc.Uno/Prism.DryIoc.Uno.WinUI.csproj +++ b/src/Uno/Prism.DryIoc.Uno/Prism.DryIoc.Uno.WinUI.csproj @@ -2,6 +2,7 @@ $(UnoTargetFrameworks) + Library $(NoWarn);1591 Prism.DryIoc.Uno Prism.DryIoc.Uno.WinUI diff --git a/src/Uno/Prism.Uno.Markup/Prism.Uno.WinUI.Markup.csproj b/src/Uno/Prism.Uno.Markup/Prism.Uno.WinUI.Markup.csproj index 2839250627..84980094cd 100644 --- a/src/Uno/Prism.Uno.Markup/Prism.Uno.WinUI.Markup.csproj +++ b/src/Uno/Prism.Uno.Markup/Prism.Uno.WinUI.Markup.csproj @@ -1,6 +1,7 @@  $(UnoTargetFrameworks) + Library true diff --git a/src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj b/src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj index b8b05f717f..655d97941e 100644 --- a/src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj +++ b/src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj @@ -2,6 +2,7 @@ $(UnoTargetFrameworks) + Library true Prism.Uno Prism diff --git a/src/Wpf/Prism.DryIoc.Wpf/Prism.DryIoc.Wpf.csproj b/src/Wpf/Prism.DryIoc.Wpf/Prism.DryIoc.Wpf.csproj index 3fdd5fdfe2..9c2a378b79 100644 --- a/src/Wpf/Prism.DryIoc.Wpf/Prism.DryIoc.Wpf.csproj +++ b/src/Wpf/Prism.DryIoc.Wpf/Prism.DryIoc.Wpf.csproj @@ -2,7 +2,7 @@ - net462;net47;net6.0-windows + net462;net47;net8.0-windows;net9.0-windows;net10.0-windows true Prism.DryIoc Prism.DryIoc diff --git a/src/Wpf/Prism.Unity.Wpf/Prism.Unity.Wpf.csproj b/src/Wpf/Prism.Unity.Wpf/Prism.Unity.Wpf.csproj index 4e7f8a93e9..e23c26a2de 100644 --- a/src/Wpf/Prism.Unity.Wpf/Prism.Unity.Wpf.csproj +++ b/src/Wpf/Prism.Unity.Wpf/Prism.Unity.Wpf.csproj @@ -2,7 +2,7 @@ - net462;net47;net6.0-windows + net462;net47;net8.0-windows;net9.0-windows;net10.0-windows true Prism.Unity Prism.Unity diff --git a/src/Wpf/Prism.Wpf/Prism.Wpf.csproj b/src/Wpf/Prism.Wpf/Prism.Wpf.csproj index 3bb40f223a..95e5cb355d 100644 --- a/src/Wpf/Prism.Wpf/Prism.Wpf.csproj +++ b/src/Wpf/Prism.Wpf/Prism.Wpf.csproj @@ -4,7 +4,7 @@ Properties Prism - net462;net47;net6.0-windows + net462;net47;net8.0-windows;net9.0-windows;net10.0-windows true Prism provides an implementation of a collection of design patterns that are helpful in writing well structured, maintainable, and testable XAML applications, including MVVM, dependency injection, commanding, event aggregation, and more. Prism's core functionality is a shared library targeting the .NET Framework and .NET. Features that need to be platform specific are implemented in the respective libraries for the target platform (WPF, Uno Platform, .NET MAUI and Xamarin Forms). diff --git a/tests/Avalonia/Prism.Avalonia.Tests/Prism.Avalonia.Tests.csproj b/tests/Avalonia/Prism.Avalonia.Tests/Prism.Avalonia.Tests.csproj index 96e305474e..81c0008422 100644 --- a/tests/Avalonia/Prism.Avalonia.Tests/Prism.Avalonia.Tests.csproj +++ b/tests/Avalonia/Prism.Avalonia.Tests/Prism.Avalonia.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 false enable false diff --git a/tests/Avalonia/Prism.DryIoc.Avalonia.Tests/Prism.DryIoc.Avalonia.Tests.csproj b/tests/Avalonia/Prism.DryIoc.Avalonia.Tests/Prism.DryIoc.Avalonia.Tests.csproj index bccbbb065b..632b77e8ce 100644 --- a/tests/Avalonia/Prism.DryIoc.Avalonia.Tests/Prism.DryIoc.Avalonia.Tests.csproj +++ b/tests/Avalonia/Prism.DryIoc.Avalonia.Tests/Prism.DryIoc.Avalonia.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 false diff --git a/tests/Avalonia/Prism.IocContainer.Avalonia.Tests.Support/Prism.IocContainer.Avalonia.Tests.Support.csproj b/tests/Avalonia/Prism.IocContainer.Avalonia.Tests.Support/Prism.IocContainer.Avalonia.Tests.Support.csproj index 7040cf1449..11e19f86dc 100644 --- a/tests/Avalonia/Prism.IocContainer.Avalonia.Tests.Support/Prism.IocContainer.Avalonia.Tests.Support.csproj +++ b/tests/Avalonia/Prism.IocContainer.Avalonia.Tests.Support/Prism.IocContainer.Avalonia.Tests.Support.csproj @@ -2,7 +2,7 @@ - net8.0 + net10.0 diff --git a/tests/Maui/Prism.DryIoc.Maui.Tests/Prism.DryIoc.Maui.Tests.csproj b/tests/Maui/Prism.DryIoc.Maui.Tests/Prism.DryIoc.Maui.Tests.csproj index b699f1ef82..0a0a293707 100644 --- a/tests/Maui/Prism.DryIoc.Maui.Tests/Prism.DryIoc.Maui.Tests.csproj +++ b/tests/Maui/Prism.DryIoc.Maui.Tests/Prism.DryIoc.Maui.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 @@ -9,7 +9,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/NavigateToExtensionFixture.cs b/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/NavigateToExtensionFixture.cs index d418566ae5..d30dafceed 100644 --- a/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/NavigateToExtensionFixture.cs +++ b/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/NavigateToExtensionFixture.cs @@ -1,3 +1,4 @@ +using Microsoft.Extensions.Logging; using Microsoft.Maui.Controls; using Moq; using Prism.Common; @@ -15,10 +16,14 @@ public class NavigateToExtensionFixture public void Execute_NameIsNull_DoesNotNavigateToPage() { var mockNavigation = Mock.Of(); + var logFactory = new Mock(); + logFactory.Setup(x => x.CreateLogger(It.IsAny())) + .Returns(Mock.Of()); var container = new TestContainer(); container.RegisterInstance(mockNavigation); container.RegisterInstance(new PageAccessor()); container.RegisterForNavigation(); + container.RegisterInstance(logFactory.Object); var registry = container.Resolve(); var page = registry.CreateView(container, "PageMock") as Page; @@ -64,10 +69,15 @@ public void Execute_NameIsSet_NavigatesToPage() public void Execute_NavigationParameters_HasKnownNavigationParameters(bool animated, bool? useModalNavigation) { var mockNavigation = Mock.Of(); + var logFactory = new Mock(); + logFactory.Setup(x => x.CreateLogger(It.IsAny())) + .Returns(Mock.Of()); + var container = new TestContainer(); container.RegisterInstance(mockNavigation); container.RegisterInstance(new PageAccessor()); container.RegisterForNavigation(); + container.RegisterInstance(logFactory.Object); INavigationParameters parameters = default; Mock.Get(mockNavigation) diff --git a/tests/Maui/Prism.Maui.Tests/Prism.Maui.Tests.csproj b/tests/Maui/Prism.Maui.Tests/Prism.Maui.Tests.csproj index 321157cdfd..7d9bf2e440 100644 --- a/tests/Maui/Prism.Maui.Tests/Prism.Maui.Tests.csproj +++ b/tests/Maui/Prism.Maui.Tests/Prism.Maui.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 @@ -10,7 +10,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Prism.Core.Tests/Prism.Core.Tests.csproj b/tests/Prism.Core.Tests/Prism.Core.Tests.csproj index 0be9112c9f..0f4e49e126 100644 --- a/tests/Prism.Core.Tests/Prism.Core.Tests.csproj +++ b/tests/Prism.Core.Tests/Prism.Core.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net10.0 false