Skip to content

Releases: PrismLibrary/Prism

7.2.0.1347 - Preview

11 Jun 00:29
d9c170f
Compare
Choose a tag to compare
7.2.0.1347 - Preview Pre-release
Pre-release

Changes:

See more
  • a2b2d34 Unify Xaml Parameters for Dialogs and Navigation
  • 6596ebf adding ParameterBase
  • 4048484 removing dependency on NavigationParameter
  • e811939 add ItemsSource
  • 6fb6998 OnNavigatingTo
  • 75d6db5 Refactoring for better code sharing between Navigation and Dialog Parameters
  • fe5847b downgrade to Xamarin.Forms 3.6 for added compatibility
  • f76990b Merge pull request #1828 from PrismLibrary/core3-directorymodulecatalog
  • 192735c Update DirectoryModuleCatalog.Core.cs
  • 906583a add outputs for NavigationInterfaces
  • d301c7d reset IsDialogHost property
  • 24e54a1 add ability to provide custom mask (i.e. gradient layer)
  • 1a49f73 fixing background tap dismissal
  • c20beae adding DialogService fixes #1814
  • b4fb6c1 Merge pull request #1827 from PrismLibrary/xamlnav
  • 8422312 Fully support bindings for Xaml Navigation fixes #1754
  • aee7c10 Merge pull request #1826 from PrismLibrary/dialog-service-updates
  • f124ac5 Update azure-pipelines.yml
  • 33585f7 updated piplines
  • f288e18 removed setter from title
  • 6f59946 Using Enum for Result
  • 1cc5f34 Merge branch 'master' into core3-directorymodulecatalog
  • 428df87 Merge pull request #1815 from hronlukas/master
  • 4551d9c Merge pull request #1817 from mcavigelli/documentation-fixes
  • cb41ff2 update deprecated build property
  • 5547afc disable Forms Sandbox
  • 56994a4 update Build Badges
  • d4a7406 ensure global.json is in Sandbox directory
  • 6eda879 fixing sandbox build options
  • 80b0aaf fixing job name
  • a1a0df6 consolidating Xamarin.Forms dependency
  • 59a0fa4 Removed unused usings.
  • 581e9d3 Tiny documentation fix.
  • c036953 Typo
  • c4fa2f0 Do not override owner in DialogService
  • 15588d0 update issue templates
  • fdf1635 Update SourceLink
  • 4f166f5 update for Multi-Stage Pipeline
  • 4e335f8 removed RegionManager from dialogservice
  • 3367c5a update readme plugins and training
  • f426e11 add AutoRegistrationViewNameProvider
  • da1fe79 Merge pull request #1808 from PrismLibrary/dryioc-ios
  • 418b52a fixes #1806
  • 81ea86c remove RegisterForNavigationAttribute provide handler for allowing custom logic on AutoRegistering Views
  • 792bd65 Dependency updates
  • eccb6e3 Merge pull request #1793 from hermestobias/master
  • 381d56c Merge pull request #1807 from PrismLibrary/IDialogService-Updates
  • 7f5b2e1 attached RegionManager to dialog by default
  • 805eca4 working on .NET Core 3 module catalog
  • 0b589ce Merge pull request #1803 from noufionline/patch-2
  • 7c0e303 Update IDialogService.cs
  • ff9641a Merge pull request #1798 from PrismLibrary/unity-upgrade
  • d294912 updated Prism.Forms
  • c794528 updated Prism.WPF to altest version of Unity
  • 2aa53df Adhere to code style guidelines
  • 886ffcf Optimize WeakDelegateReference by introducing TargetEquals, which takes 60% less time than comparing with Target if it's still alive, and makes WeakDelegate.RemoveListener take 90% less time in normal usage.
  • d5569a5 Merge pull request #1780 from PrismLibrary/automatic-registration
  • 5c11a75 rename registration attribute to align with the AutoLoad API as AutoRegisterForNavigation
  • ae667e7 Merge pull request #1779 from PrismLibrary/IInitialize
  • d654987 update from OnInitialized -> Initialize
  • 3c175ab Updating DryIoc, Xamarin Forms & Test SDK
  • 170307e Adds support for View Registration by Attribute or automatic View Registration.
  • 2dbdd04 Implementing IInitialize fixes #1746 fixes #1748
  • eb49282 migrate Navigation back to Prism Forms
  • a1d383d Merge pull request #1761 from PrismLibrary/IDialogService-Updates
  • b5a43fd fixed ninject project
  • c95d6cf Refactored DialogWindow attached properties
  • 2507daf Merge pull request #1749 from PrismLibrary/IDialogService-Updates
  • 273eab2 Merge branch 'master' into IDialogService-Updates
  • 36f8d81 removed dialog VM base class
  • 6d23d45 removing UWP
  • 9623596 Merge pull request #1731 from bartlannoeye/Cleanup
  • b6c9ab6 Cleanup project files
  • c0d9ed6 Merge pull request #1730 from PrismLibrary/forms36
  • 6e1aa89 removing netstandard1.0
  • c139004 moving Android DependencyResolver to PrismApplicationBase
  • a2bd997 updating Xamarin Forms and DryIoc
  • 5111104 Merge pull request #1722 from PrismLibrary/IDialogService-Updates
  • e8effd4 removed Icon property
  • 2d68c0f Merge pull request #1721 from PrismLibrary/IDialogService-Updates
  • a6c8e84 added RegisterDialog method without VM requirement
  • 6494cf4 added support to control DialogWindow from style
  • 04cc589 Merge pull request #1714 from noufionline/patch-2
  • c14d28d Update DialogService.cs
  • d476877 Merge pull request #1709 from PrismLibrary/WPF-IDestructible
  • df7414c added support for IDestructible
  • 982d21f fixing release notes
  • a9e22df Merge pull request #1705 from PrismLibrary/fluent-containerregistry [ #1677 ]
  • 45f6a18 Fluent API for IContainerRegistry fixes #1677
  • a041c7f Merge pull request #1704 from PrismLibrary/forms-updates
  • cc74034 update Xamarin.Forms
  • dec906e make NavigationExtension bindable
  • 336a405 removing unneeded extensions
  • 779a290 Merge pull request #1703 from PrismLibrary/uwp-simplifications
  • f50bcdb PrismApplication simplification
  • 2109273 Merge pull request #1702 from PrismLibrary/PlatformSpecificViewRegistration
  • c8f208f fixes #1700 Platform specific Views not registered
  • 8e22c9f Adding tests for Idiom and Platform specific View registrations
  • 508b5c8 Merge pull request #1685 from PrismLibrary/uwp-di
  • 9aaec2f Merge pull request #1684 from bares43/feature/XamlNavigationAnimated
  • fac1d29 FrameFacade DI fixes
  • f35fd65 fixing naming
  • 2b503a2 updating Sandbox app to follow better MVVM patterns
  • ab1b6ad simplify startup
  • 6e81769 force use of Microsoft...
Read more

7.2.0.1233-pre - Preview

16 May 21:53
d5569a5
Compare
Choose a tag to compare
Pre-release

This is the 3rd public preview for Prism 7.2.

This preview provides a number of bug fixes and enhancements.

Prism Core

  • #1668: Expands IoC abstractions to allow checking for registered services and naming instances or singletons.
  • #1680: Fixes Ambiguous match when using DelegateCommand.ObserveProperty
  • #1677: Changes IContainerRegistry to provide a Fluent API

Prism.WPF

  • #1296: Support for IDestructilbe in WPF projects
  • #1544: .Net Core 3 Support
  • #1601: InitializeModules() should be called even if there's no shell
  • #1676: Ambiguous match found when ObserveProperty
  • #1666: A New IDialogService for WPF

A New IDialogService for WPF

Currently, the only way to show any type of dialog with Prism is by using the PopupWindowAction in combination with System.Windows.Interactivity. To be honest, I really dislike this approach. It's over complex, highly verbose, difficult to implement, and is very limited. The limitations are covered pretty well in Issue #864

Instead, I created a new IDialogService API that will replace the PopupWindowAction altogether. This service will allow developers to show any dialog they want either modal, or non-modal, and have complete control over their dialog logic.

The implementation looks like this:

    public interface IDialogService
    {
        void Show(string name, IDialogParameters parameters, Action<IDialogResult> callback);
        void ShowDialog(string name, IDialogParameters parameters, Action<IDialogResult> callback);
    }

The idea here is that Prism will no longer provide any built-in dialogs like Notification or Confirmation. Mainly because the Prism implementations are UGLY and will never match the styling of your beautiful WPF application. So, it's important that you are able to register your own dialogs.

Create Your Dialog View

Your dialog view is a simple UserContro l that can be designed anyway you please. The only requirement it has a ViewModel that implements IDialogAware set as it's DataContext. Preferably, it will utilize the ViewModelLocator

<UserControl x:Class="HelloWorld.Dialogs.NotificationDialog"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:prism="http://prismlibrary.com/"
             prism:ViewModelLocator.AutoWireViewModel="True"
             Width="300" Height="150">
    <Grid x:Name="LayoutRoot" Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Text="{Binding Message}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="0" TextWrapping="Wrap" />
        <Button Command="{Binding CloseDialogCommand}" CommandPrameter="true" Content="OK" Width="75" Height="25" HorizontalAlignment="Right" Margin="0,10,0,0" Grid.Row="1" IsDefault="True" />
    </Grid>
</UserControl>

Create Your Dialog ViewModel

Next you need a ViewModel that implements IDialogAware which is defined as follows

    public interface IDialogAware
    {
        bool CanCloseDialog();
        void OnDialogClosed();
        void OnDialogOpened(IDialogParameters parameters);
        string Title { get; set; }
        event Action<IDialogResult> RequestClose;
    }

Here is a simple example of what an IDialogAware ViewModel may look like.

    public class NotificationDialogViewModel : BindableBase, IDialogAware
    {
        private DelegateCommand<string> _closeDialogCommand;
        public DelegateCommand<string> CloseDialogCommand =>
            _closeDialogCommand ?? (_closeDialogCommand = new DelegateCommand<string>(CloseDialog));

        private string _message;
        public string Message
        {
            get { return _message; }
            set { SetProperty(ref _message, value); }
        }

        private string _title = "Notification";
        public string Title
        {
            get { return _title; }
            set { SetProperty(ref _title, value); }
        }

        public event Action<IDialogResult> RequestClose;

        protected virtual void CloseDialog(string parameter)
        {
            bool? result = null;

            if (parameter?.ToLower() == "true")
                result = true;
            else if (parameter?.ToLower() == "false")
                result = false;

            RaiseRequestClose(new DialogResult(result));
        }

        public virtual void RaiseRequestClose(IDialogResult dialogResult)
        {
            RequestClose?.Invoke(dialogResult);
        }

        public virtual bool CanCloseDialog()
        {
            return true;
        }

        public virtual void OnDialogClosed()
        {

        }

        public virtual void OnDialogOpened(IDialogParameters parameters)
        {
            Message = parameters.GetValue<string>("message");
        }
    }

Register the Dialog

To register a dialog, you must have a View (UserControl) and a corresponding ViewModel (which must implement IDialogAware). In the RegisterTypes method, simply register your dialog like you would any other service by using the IContainterRegistery.RegisterDialog method.

 protected override void RegisterTypes(IContainerRegistry containerRegistry)
 {
     containerRegistry.RegisterDialog<NotificationDialog, NotificationDialogViewModel>();
 }

Using the Dialog Service

To use the dialog service you simply ask for the service in your VM ctor.

public MainWindowViewModel(IDialogService dialogService)
{
    _dialogService = dialogService;
}

Then call either Show or ShowDialog providing the name of the dialog, any parameters your dialogs requires, and then handle the result via a call back

private void ShowDialog()
{
    var message = "This is a message that should be shown in the dialog.";
    //using the dialog service as-is
    _dialogService.ShowDialog("NotificationDialog", new DialogParameters($"message={message}"), r =>
    {
        if (!r.Result.HasValue)
            Title = "Result is null";
        else if (r.Result == true)
            Title = "Result is True";
        else if (r.Result == false)
            Title = "Result is False";
        else
            Title = "What the hell did you do?";
    });
}

Simplify your Application Dialog APIs

The intent of the dialog API is not to try and guess exactly what type of parameters your need for all of your dialogs, but rather to just create and show the dialogs. To simplify common dialogs in your application the guidance will be to create an extension methods to simplify your applications dialogs.

For example:

public static class DialogServiceEstensions
{
    public static void ShowNotification(this IDialogService dialogService, string message, Action<IDialogResult> callBack)
    {
        dialogService.ShowDialog("NotificationDialog", new DialogParameters($"message={message}"), callBack);
    }
}

Then to call your Notifications use the new and improved API that you created specifically for your app.

    _dialogService.ShowNotification(message, r =>
    {
        if (!r.Result.HasValue)
            Title = "Result is null";
        else if (r.Result == true)
            Title = "Result is True";
        else if (r.Result == false)
            Title = "Result is False";
        else
            Title = "What the hell did you do?";
    });

Register a Custom Dialog Window

It's very common to be using a third-party control vendor such as Infragistics. In these cases, you may want to replace the standard WPF Window control that hosts the dialogs with a custom Window class such as the Infragistics XamRibbonWindow control.

In this case, just create your custom Window, and implement the IDialogWindow interface:

public partial class MyRibbonWindow: XamRibbonWindow, IDialogWindow
{
    public IDialogResult Result { get; set; }
    ….
}

Then register your dialog window with the IContainerRegistry.

 protected override void RegisterTypes(IContainerRegistry containerRegistry)
 {
     containerRegistry.RegisterDialogWindow<MyRibbonWindow>();
 }

Style the DailogWindow

You can control the properties of the DialogWindow by using a style via an attatched property on the Dialog UserControl

    <prism:Dialog.WindowStyle>
        <Style TargetType="Window">
            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
            <Setter Property="ResizeMode" Value="NoResize"/>
            <Setter Property="ShowInTaskbar" Value="False"/>
            <Setter Property="SizeToContent" Value="WidthAndHeight"/>
        </Style>
    </prism:Dialog.WindowStyle>

To clarify, this is to replace the PopupWindowAction. I want to remove that mess completely from Prism

Prism.Forms

  • #1589: OnNavigatedFrom method is not called when changing detail on MasterDetailPage
  • #1615: Add the ability to switch tabs
  • #1625: Master Detail to Tab Page Navigation broken in 7.1
  • #1683: Add navigation animation or modal navigation with XAML Navigation Extensions
  • #1663: Refactored platform navigation methods
  • #1669: Allow Create/Destroy Action Sheet buttons with only a name. Allow passing tuples to Navigation Service
  • #1700: Platform Specific View Registration not respected
  • #1704: Make XAML Navigation Extensions inherit from BindableObject. Make properties Bindable
  • #1748: [BREAKING] Make INavigatingAware Obsolete and introduce IInitialize, IInitializeAsync & IAutoInitialize
  • #1757: Add Automatic View Registration

View/ViewModel Initialization

After numerous user survey's and interviews it became apparent that the intent of INavigatingAware ...

Read more

7.2.0.1038-pre - Preview

20 Feb 20:29
Compare
Choose a tag to compare
Pre-release

General Notes

This is the 2nd public preview for Prism 7.2, and the 1st public preview of the new Prism for UWP (aka Prism.Windows). Note that the UWP API's may still be in flux prior to release.

This preview provides a number of bug fixes and enhancements.

#Prism Core

  • #1348: Navigation Alignment - moved all navigation interfaces into Prism Core (currently hidden from WPF)
  • #1476: Module Alignment - moved Exceptions, ModuleInfo, and several Modularity interfaces to Prism.Core from WPF combining with some Prism.Forms definitions.
  • IModuleManager.ModuleDownloadProgressChanged (available in net45 aka WPF ONLY)
  • #1505: Memory problem with EventAggregator and never published message
  • #1509: Module Alignment Updates: Introduce IModuleInfo
  • #1511: Module Alignment
  • All modularity interfaces and base & supporting types moved to Prism.Core
  • IContainerRegistry now has a Fluent API. All registration methods now return IContainerRegistry to allow chaining registrations.
  • IContainerRegistry has expanded API's to help with additional scenarios where you might need a named type.
  • IContainerProvider has expanded API's to help resolve Types with specific instances that may be needed for resolution.
  • (Forms and UWP) INavigationService now has extension methods to support the use of Tuples for NavigationParameters eliminating the need to specifically create new NavigationParameters when Navigating.

Prism.WPF

  • #1544: .Net Core 3 Support
  • #1601: InitializeModules() should be called even if there's no shell
  • #1676: Ambiguous match found when ObserveProperty
  • #1666: A New IDialogService for WPF
  • Introduces a new IDialogService that will replace the PopupWindowAction altogether. This service will allow developers to show any dialog they want either modal, or non-modal, and have complete control over their dialog logic.

Prism.Forms

  • #1589: OnNavigatedFrom method is not called when changing detail on MasterDetailPage
  • #1615: Add the ability to switch tabs
  • #1625: Master Detail to Tab Page Navigation broken in 7.1
  • #1683: Xaml navigation without animation isn't working
  • XAML Navigation Extensions are now Bindable. Among the benefits includes that when coupled with the new BindableLayout in Xamarin.Forms you could use this to build dynamic Menu's in XAML
  • XAML Navigation now allows you to specify whether the Navigation should be Animated or Use Modal Navigation
  • Fixed registration of Views by Platform
  • Changed target Xamarin.Forms version from 4.0-pre1 to 3.5 SR1

7.2.0.708-pre - Preview

04 Dec 17:02
bee0480
Compare
Choose a tag to compare
Pre-release

Special Release

This is a special preview for Microsoft Connect.

Prism.WPF

  • #1544: .Net Core 3 Support
  • #1601: InitializeModules() should be called even if there's no shell

Prism.Forms

  • #1589: OnNavigatedFrom method is not called when changing detail on MasterDetailPage
  • #1615: Add the ability to switch tabs
  • #1625: Master Detail to Tab Page Navigation broken in 7.1
  • Support for Xamarin Forms developers using 4.0 pre1 to use the new Prism namespace to access all vital Prism types from XAML
<ContentPage xmlns:prism="http://prismlibrary.com">
  <ListView>
    <ListView.Behaviors>
      <prism:EventToCommandBehavior ... />
    </ListView.Behaviors>
  </ListView>
</ContentPage>

Prism.Windows

  • New guidance - Merged with Template 10

7.1.0 RTM

15 Oct 16:11
9d05095
Compare
Choose a tag to compare

General Notes

In addition to the typical bug fixes Prism 7.1 brings a much more consolidated approach to developing applications. Perhaps this is most clear with Prism.Modularity now being defined entirely in the Prism.Core providing a consistent API for Prism.Forms and Prism.WPF, as well as making it available for the first time to Prism.Windows (in an upcoming preview).

Due to the major changes in where certain types are for Modularity (and Navigation for Prism.Forms), you may experience binary incompatibility issues when using libraries that target older versions of Prism.

Container Notices

Going forward we will only consider support for containers that work properly for Prism. The Prism team advises all developers to update projects to use the new PackageReference, this will help simplify maintaining which packages you need to update by simply targeting the Prism Container package (see Unity notice).

Autofac

After much discussion the Prism team has decided that this will be the final release for Autofac. Modularity is a core capability for Prism, which requires the use of a Mutable container. The fact that the Autofac team has chosen to make Autofac Immutable prevents us from being able to support the use of containers.

MEF

Similarly the Prism team has decided that we will no longer be shipping or supporting MEF for WPF, nor will support be added for any other platforms.

Unity

Unity continues to be a very popular and fully supported container. For those upgrading to Prism 7.1 from Prism 6.X, note that you will need to uninstall the Unity references in your existing projects as the new maintainer for Unity has completely rearchitected the Unity Container. This included changing namespaces and changing how the library was shipped forcing the Prism Team to change the NuGet that we target from Unity to Unity.Container.

Prism.Core

  • #1348: Navigation Alignment - moved all navigation interfaces into Prism Core (currently hidden from WPF)
  • #1476: Module Alignment - moved Exceptions, ModuleInfo, and several Modularity interfaces to Prism.Core from WPF combining with some Prism.Forms definitions.
    • IModuleManager.ModuleDownloadProgressChanged (available in net45 aka WPF ONLY)
  • #1505: Memory problem with EventAggregator and never published message
  • #1509: Module Alignment Updates: Introduce IModuleInfo
  • #1511: Module Alignment
    • All modularity interfaces and base & supporting types moved to Prism.Core

Prism.Forms

  • #1348: Navigation alignment
    • Added INavigationParameters
    • Added INavigationParametersInternal
    • Added INavigationResult
    • Convert all methods using NavigationParameters to use the new INavigationParameters BREAKING
    • Changed Task INavigationService.NavigateAsync to Task<INavigationResult> INavigationService.NavigateAsync
    • Changed Task<bool> INavigationService.GoBackAsync to Task<INavigationResult> INavigationService.GoBackAsync BREAKING
  • #1347: ContainerProvider - Allows Declaring Types in XAML that require the Container to Resolve them
  • #1353: NavigationFrom not called when navigate to different Hamburger Menu Page
  • #1354: INavigationAware methods are not called on children of a CarouselPage
  • #1403: Remove pages from NavigationStack without pushing another one
  • #1414: Changed from Unity NuGet to Unity.Container BREAKING
  • #1425: XAML Navigation
  • #1439: DependencyResolver
  • #1456: Relative back navigation does not work with INavigationParameters
  • #1463: DryIoc Default Rules Change. By default DryIoc will attempt to resolve types based on an available constructor with resolvable types. Secondary registrations will now replace any initial registration by default.
  • #1464: Unity and Autofac no longer require INavigationService to be named navigationService inside of a ViewModel.
  • #1469: Make Xamarin.Forms DependencyResolver Opt-In
  • #1476: Module Alignment BREAKING
    • ModuleInfo.ModuleType has changed from System.Type to System.String and is equal to Type.AssemblyQualifiedName
    • IModuleManager.LoadModuleCompleted - Forms will now invoke this event when a new module has been loaded. Note there is not currently a default handler provided by PrismApplication. This event will contain any caught exception that was thrown while attempting to load a Module.
    • Moved all Modularity interfaces except IModuleCatalog to Prism.Core
  • #1509: Module Alignment
    • Adds IModuleInfo
    • ModuleInfo moved back to Prism.Forms. ModuleInfo will now return Module Dependencies when decorated with the ModuleDependencyAttribute if dependencies are not set at Registration.
  • #1511: Module Alignment - All modularity interfaces and base & supporting types moved to Prism.Core
  • #1519: Support Partial Views in Xamarin Forms
  • #1546: MasterDetailPage navigation on iOS is unexcepted
  • #1549: EventToCommandBehavior.OnEventRaised NullReferenceException

Partial Views

The concept of a Partial View is to support a custom layout which may be reused across multiple pages, and eliminate ViewModel logic duplication by allowing that custom layout to rely on its own ViewModel. To use a Partial View you must set the ViewModelLocator.AutowirePartialView property with a reference to the containing page as shown here. You should not set the ViewModelLocator.AutowireViewModel property on the Partial View unless you are explicitly opting out as setting this property to true directly may result in the ViewModel being incorrectly set.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:AwesomeApp.Views"
             xmlns:prism="clr-namespace:Prism.Ioc;assembly=Prism.Forms"
             xmlns:mvvm="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
             x:Name="self"
             x:Class="AwesomeApp.Views.ViewA">
  <StackLayout>
    <local:AwesomeView mvvm:ViewModelLocator.AutowirePartialView="{x:Reference self}" />
    <Entry Text="{Binding SomeValue" />
  </StackLayout>
</ContentPage>

Dependency Resolver

Xamarin.Forms 3.1 introduces a new DependencyResolver. This enables applications using Dependency Injection to use their Container to resolve Platform Renderers and Effects which makes it possible to inject any services such as a logger. Since the default constructor was deprecated in Android Renderers as of Xamarin.Forms 2.5, Prism now includes a specific Android binary that enables the DependencyResolver to resolve types using

ContainerProvider

The Container Provider now allows types like ValueConverters to include Dependency Injection of Types/Services in the ctor, and allows the converter to be declared in XAML

namespace Contoso.Converters
{
    public class MyValueConverter : IValueConverter
    {
        private ILoggerFacade _logger { get; }

        public MyValueConverter(ILoggerFacade logger)
        {
            _logger = logger;
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _logger.Log("Converting value", Category.Debug, Priority.None);
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _logger.Log("Converting Value Back...", Category.Debug, Priority.None);
            return value;
        }
    }
}

This can then be used in XAML using the ContainerProvider as follows:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:ioc="clr-namespace:Prism.Ioc;assembly=Prism.Forms"
             xmlns:converters="using:Contoso.Converters"
             x:Class="Contoso.Views.ViewA">
    <ContentPage.Resources>
        <ResourceDictionary>
            <ioc:ContainerProvider x:TypeArguments="converters:MyValueConverter" x:Key="myValueConverter" />
        </ResourceDictionary>
    </ContentPage.Resources>
    <Entry Text="{Binding Demo,Converter={StaticResource myValueConverter}}" />
</ContentPage>

Navigation Improvements

**Implemented relative back behavior ("../../") **

Previously, when using the relative back feature ("../" ) you would be required to provide a page that would be pushed onto the navigation stack. That is no longer required. You may now chain together any number of relative go-back instructions to "go back".

For example:
Given your navigation stack looked like this: NavigationPage/UserList/UserDetails/LoginPage/EditUser

You can now indicate how many pages to remove, or "go back" by chaining the relative go-back instruction "../".

NavigationService.NavigateAsync("../../../");

This would result in going back three pages leaving you with the following navigation stack:

NavigationPage/UserList

NOTE - The pages in the stack prior to the current page (last page in the nav stack) will be removed without calling any INavAware methods. Only the current page (EditUser in this example) would perform a proper GoBackAsync and execute the INavAware methods.

NOTE - This feature is only supported while within the context of a NavigationPage.

XAML Navigation

You can now use XAML Navigation Extensions to Navigate. This works well for scenarios where you may have a partial "MenuView" that may be reused across multiple Pages or where there may be no real reason to implement Navigation inside of a ViewModel.

<!-- basic nav -->
<Button Text="Go To About" Command"{prism:NavigateTo 'About'}" />

<!-- basic nav without animation-->
<Button Text="Go To About" Command"{prism:NavigateTo 'About', Animated=False}" />

<!-- basic modal nav -->
<Button Text="Go To About" Command"{pr...
Read more

7.1.0 Preview 4

20 Sep 21:10
Compare
Choose a tag to compare
7.1.0 Preview 4 Pre-release
Pre-release

General

This release introduces the final API alignment for Prism.Modularity. This undoes some breaking changes made in Preview 3 to make the upgrade path easier for WPF apps that declare ModuleCatalogs in XAML. This also introduces support for Partial Views for Xamarin Forms.

Prism.Core

  • #1348: Navigation Alignment - moved all navigation interfaces into Prism Core (currently hidden from WPF)
  • #1476: Module Alignment - moved Exceptions, ModuleInfo, and several Modularity interfaces to Prism.Core from WPF combining with some Prism.Forms definitions.
    • IModuleManager.ModuleDownloadProgressChanged (available in net45 aka WPF ONLY)
  • #1505: Memory problem with EventAggregator and never published message
  • #1509: Module Alignment Updates: Introduce IModuleInfo
  • #1511: Module Alignment
    • All modularity interfaces and base & supporting types moved to Prism.Core

Prism.Forms

  • #1348: Navigation alignment
    • Added INavigationParameters
    • Added INavigationParametersInternal
    • Added INavigationResult
    • Convert all methods using NavigationParameters to use the new INavigationParameters BREAKING
    • Changed Task INavigationService.NavigateAsync to Task<INavigationResult> INavigationService.NavigateAsync
    • Changed Task<bool> INavigationService.GoBackAsync to Task<INavigationResult> INavigationService.GoBackAsync BREAKING
  • #1347: ContainerProvider - Allows Declaring Types in XAML that require the Container to Resolve them
  • #1353: NavigationFrom not called when navigate to different Hamburger Menu Page
  • #1354: INavigationAware methods are not called on children of a CarouselPage
  • #1403: Remove pages from NavigationStack without pushing another one
  • #1414: Changed from Unity NuGet to Unity.Container BREAKING
  • #1425: XAML Navigation
  • #1439: DependencyResolver
  • #1456: Relative back navigation does not work with INavigationParameters
  • #1463: DryIoc Default Rules Change. By default DryIoc will attempt to resolve types based on an available constructor with resolvable types. Secondary registrations will now replace any initial registration by default.
  • #1464: Unity and Autofac no longer require INavigationService to be named navigationService inside of a ViewModel.
  • #1469: Make Xamarin.Forms DependencyResolver Opt-In
  • #1476: Module Alignment BREAKING
    • ModuleInfo.ModuleType has changed from System.Type to System.String and is equal to Type.AssemblyQualifiedName
    • IModuleManager.LoadModuleCompleted - Forms will now invoke this event when a new module has been loaded. Note there is not currently a default handler provided by PrismApplication. This event will contain any caught exception that was thrown while attempting to load a Module.
    • Moved all Modularity interfaces except IModuleCatalog to Prism.Core
  • #1509: Module Alignment
    • Adds IModuleInfo
    • ModuleInfo moved back to Prism.Forms. ModuleInfo will now return Module Dependencies when decorated with the ModuleDependencyAttribute if dependencies are not set at Registration.
  • #1511: Module Alignment - All modularity interfaces and base & supporting types moved to Prism.Core
  • #1519: Support Partial Views in Xamarin Forms
  • #1546: MasterDetailPage navigation on iOS is unexcepted
  • #1549: EventToCommandBehavior.OnEventRaised NullReferenceException

Partial Views

The concept of a Partial View is to support a custom layout which may be reused across multiple pages, and eliminate ViewModel logic duplication by allowing that custom layout to rely on its own ViewModel. To use a Partial View you must set the ViewModelLocator.AutowirePartialView property with a reference to the containing page as shown here. You should not set the ViewModelLocator.AutowireViewModel property on the Partial View unless you are explicitly opting out as setting this property to true directly may result in the ViewModel being incorrectly set.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:AwesomeApp.Views"
             xmlns:prism="clr-namespace:Prism.Ioc;assembly=Prism.Forms"
             xmlns:mvvm="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
             x:Name="self"
             x:Class="AwesomeApp.Views.ViewA">
  <StackLayout>
    <local:AwesomeView mvvm:ViewModelLocator.AutowirePartialView="{x:Reference self}" />
    <Entry Text="{Binding SomeValue" />
  </StackLayout>
</ContentPage>

Dependency Resolver

Xamarin.Forms 3.1 introduces a new DependencyResolver. This enables applications using Dependency Injection to use their Container to resolve Platform Renderers and Effects which makes it possible to inject any services such as a logger. Since the default constructor was deprecated in Android Renderers as of Xamarin.Forms 2.5, Prism now includes a specific Android binary that enables the DependencyResolver to resolve types using

ContainerProvider

The Container Provider now allows types like ValueConverters to include Dependency Injection of Types/Services in the ctor, and allows the converter to be declared in XAML

namespace Contoso.Converters
{
    public class MyValueConverter : IValueConverter
    {
        private ILoggerFacade _logger { get; }

        public MyValueConverter(ILoggerFacade logger)
        {
            _logger = logger;
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _logger.Log("Converting value", Category.Debug, Priority.None);
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _logger.Log("Converting Value Back...", Category.Debug, Priority.None);
            return value;
        }
    }
}

This can then be used in XAML using the ContainerProvider as follows:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:ioc="clr-namespace:Prism.Ioc;assembly=Prism.Forms"
             xmlns:converters="using:Contoso.Converters"
             x:Class="Contoso.Views.ViewA">
    <ContentPage.Resources>
        <ResourceDictionary>
            <ioc:ContainerProvider x:TypeArguments="converters:MyValueConverter" x:Key="myValueConverter" />
        </ResourceDictionary>
    </ContentPage.Resources>
    <Entry Text="{Binding Demo,Converter={StaticResource myValueConverter}}" />
</ContentPage>

Navigation Improvements

**Implemented relative back behavior ("../../") **

Previously, when using the relative back feature ("../" ) you would be required to provide a page that would be pushed onto the navigation stack. That is no longer required. You may now chain together any number of relative go-back instructions to "go back".

For example:
Given your navigation stack looked like this: NavigationPage/UserList/UserDetails/LoginPage/EditUser

You can now indicate how many pages to remove, or "go back" by chaining the relative go-back instruction "../".

NavigationService.NavigateAsync("../../../");

This would result in going back three pages leaving you with the following navigation stack:

NavigationPage/UserList

NOTE - The pages in the stack prior to the current page (last page in the nav stack) will be removed without calling any INavAware methods. Only the current page (EditUser in this example) would perform a proper GoBackAsync and execute the INavAware methods.

NOTE - This feature is only supported while within the context of a NavigationPage.

XAML Navigation

You can now use XAML Navigation Extensions to Navigate. This works well for scenarios where you may have a partial "MenuView" that may be reused across multiple Pages or where there may be no real reason to implement Navigation inside of a ViewModel.

<!-- basic nav -->
<Button Text="Go To About" Command"{prism:NavigateTo 'About'}" />

<!-- basic nav without animation-->
<Button Text="Go To About" Command"{prism:NavigateTo 'About', Animated=False}" />

<!-- basic modal nav -->
<Button Text="Go To About" Command"{prism:NavigateTo 'About', UseModalNavigation=True}" />

<!-- custom can navigate support -->
<Button Text="Go To About" Command="{prism:NavigateTo 'About'}" prism:Navigation.CanNavigate="{Binding CanNavigate}" />

<!-- go to new page, but remove one along the way -->
<Button Text="Go To Settings" Command"{prism:NavigateTo '../Settings'}" />

<!-- nav with VM Parameters -->
<Button Text="Go To About" 
        Command"{prism:NavigateTo 'About'}" 
        CommandParameters="{Binding MyNavParams}" />

<!-- Go Back -->
<Button Text="Go Back" Command="{prism:GoBack}" />

<!-- Go Back To Root -->
<Button Text="Go Back To Root" Command="{prism:GoBack ToRoot}" />

<!-- Xaml defined parameters -->
<Button Text="Go To About" Command="{prism:NavigateTo 'About'}" >
    <Button.CommandParameter>
        <prism:XamlNavigationParameters Parent="{x:Reference this}">
            <prism:XamlNavigationParameter Key="MainPageViewModel" Value="{Binding .}" />
        </prism:XamlNavigationParameters>
    </Button.CommandParameter>
</Button>

<!-- can navigate on a parent object-->
<ContentView>
    <ContentView prism:Navigation.CanNavigate="False">
        <ContentView>
            <Button Text="Cannot Navigate" Command="{prism:GoBack}" /> 
        </ContentView>
    </ContentView>
</ContentView>

Prism.WPF

  • #30: Removing from, or opting out of registration, in the IRegionNavigationJournal
  • #993: RemoveAll throws if KeepAlive is false
  • #1013: MEF DirectoryModuleCatalog - problem with diacritics since 6.3
  • #1120: Prism.Autofac RegisterTypeForNavigation issue
  • #...
Read more

7.1.0 Preview 3

15 Jun 17:13
7356b9c
Compare
Choose a tag to compare
7.1.0 Preview 3 Pre-release
Pre-release

General

Prism now has support for SourceLink. This adds metadata that allow Visual Studio to determine the exact commit that was built and pull the source from GitHub from that commit, thus allowing you to step directly into Prism's code while debugging.

Trust is important, and we believe you should be able to trust that the NuGet Packages we ship are authentic and have not been tampered with. As such all Prism NuGet packages are now signed by our EV Certificate providing you the ability to see very clearly that the package is authentically from the Prism team.

Prism.Core

  • #1348: Navigation Alignment - moved all navigation interfaces into Prism Core (currently hidden from WPF)
  • #1476: Module Alignment - moved Exceptions, ModuleInfo, and several Modularity interfaces to Prism.Core from WPF combining with some Prism.Forms definitions.
    • IModuleManager.ModuleDownloadProgressChanged (available in net45 aka WPF ONLY)

Prism.Forms

  • #1348: Navigation alignment
    • Added INavigationParameters
    • Added INavigationParametersInternal
    • Added INavigationResult
    • Convert all methods using NavigationParameters to use the new INavigationParameters BREAKING
    • Changed Task INavigationService.NavigateAsync to Task<INavigationResult> INavigationService.NavigateAsync
    • Changed Task<bool> INavigationService.GoBackAsync to Task<INavigationResult> INavigationService.GoBackAsync BREAKING
  • #1347: ContainerProvider - Allows Declaring Types in XAML that require the Container to Resolve them
  • #1353: NavigationFrom not called when navigate to different Hamburger Menu Page
  • #1354: INavigationAware methods are not called on children of a CarouselPage
  • #1403: Remove pages from NavigationStack without pushing another one
  • #1414: Changed from Unity NuGet to Unity.Container BREAKING
  • #1425: XAML Navigation
  • #1439: DependencyResolver
  • #1456: Relative back navigation does not work with INavigationParameters
  • #1463: DryIoc Default Rules Change. By default DryIoc will attempt to resolve types based on an available constructor with resolvable types. Secondary registrations will now replace any initial registration by default.
  • #1464: Unity and Autofac no longer require INavigationService to be named navigationService inside of a ViewModel.
  • #1469: Make Xamarin.Forms DependencyResolver Opt-In
  • #1476: Module Alignment BREAKING
    • ModuleInfo.ModuleType has changed from System.Type to System.String and is equal to Type.AssemblyQualifiedName
    • IModuleManager.LoadModuleCompleted - Forms will now invoke this event when a new module has been loaded. Note there is not currently a default handler provided by PrismApplication. This event will contain any caught exception that was thrown while attempting to load a Module.
    • Moved all Modularity interfaces except IModuleCatalog to Prism.Core

Dependency Resolver

Xamarin.Forms 3.1 introduces a new DependencyResolver. This enables applications using Dependency Injection to use their Container to resolve Platform Renderers and Effects which makes it possible to inject any services such as a logger. Since the default constructor was deprecated in Android Renderers as of Xamarin.Forms 2.5, Prism now includes a specific Android binary that enables the DependencyResolver to resolve types using

ContainerProvider

The Container Provider now allows types like ValueConverters to include Dependency Injection of Types/Services in the ctor, and allows the converter to be declared in XAML

namespace Contoso.Converters
{
    public class MyValueConverter : IValueConverter
    {
        private ILoggerFacade _logger { get; }

        public MyValueConverter(ILoggerFacade logger)
        {
            _logger = logger;
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _logger.Log("Converting value", Category.Debug, Priority.None);
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _logger.Log("Converting Value Back...", Category.Debug, Priority.None);
            return value;
        }
    }
}

This can then be used in XAML using the ContainerProvider as follows:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:ioc="clr-namespace:Prism.Ioc;assembly=Prism.Forms"
             xmlns:converters="using:Contoso.Converters"
             x:Class="Contoso.Views.ViewA">
    <ContentPage.Resources>
        <ResourceDictionary>
            <ioc:ContainerProvider x:TypeArguments="converters:MyValueConverter" x:Key="myValueConverter" />
        </ResourceDictionary>
    </ContentPage.Resources>
    <Entry Text="{Binding Demo,Converter={StaticResource myValueConverter}}" />
</ContentPage>

Navigation Improvements

**Implemented relative back behavior ("../../") **

Previously, when using the relative back feature ("../" ) you would be required to provide a page that would be pushed onto the navigation stack. That is no longer required. You may now chain together any number of relative go-back instructions to "go back".

For example:
Given your navigation stack looked like this: NavigationPage/UserList/UserDetails/LoginPage/EditUser

You can now indicate how many pages to remove, or "go back" by chaining the relative go-back instruction "../".

NavigationService.NavigateAsync("../../../");

This would result in going back three pages leaving you with the following navigation stack:

NavigationPage/UserList

NOTE - The pages in the stack prior to the current page (last page in the nav stack) will be removed without calling any INavAware methods. Only the current page (EditUser in this example) would perform a proper GoBackAsync and execute the INavAware methods.

NOTE - This feature is only supported while within the context of a NavigationPage.

XAML Navigation

You can now use XAML Navigation Extensions to Navigate. This works well for scenarios where you may have a partial "MenuView" that may be reused across multiple Pages or where there may be no real reason to implement Navigation inside of a ViewModel.

<!-- basic nav -->
<Button Text="Go To About" Command"{prism:NavigateTo 'About'}" />

<!-- basic nav without animation-->
<Button Text="Go To About" Command"{prism:NavigateTo 'About', Animated=False}" />

<!-- basic modal nav -->
<Button Text="Go To About" Command"{prism:NavigateTo 'About', UseModalNavigation=True}" />

<!-- custom can navigate support -->
<Button Text="Go To About" Command="{prism:NavigateTo 'About'}" prism:Navigation.CanNavigate="{Binding CanNavigate}" />

<!-- go to new page, but remove one along the way -->
<Button Text="Go To Settings" Command"{prism:NavigateTo '../Settings'}" />

<!-- nav with VM Parameters -->
<Button Text="Go To About" 
        Command"{prism:NavigateTo 'About'}" 
        CommandParameters="{Binding MyNavParams}" />

<!-- Go Back -->
<Button Text="Go Back" Command="{prism:GoBack}" />

<!-- Go Back To Root -->
<Button Text="Go Back To Root" Command="{prism:GoBack ToRoot}" />

<!-- Xaml defined parameters -->
<Button Text="Go To About" Command="{prism:NavigateTo 'About'}" >
    <Button.CommandParameter>
        <prism:XamlNavigationParameters Parent="{x:Reference this}">
            <prism:XamlNavigationParameter Key="MainPageViewModel" Value="{Binding .}" />
        </prism:XamlNavigationParameters>
    </Button.CommandParameter>
</Button>

<!-- can navigate on a parent object-->
<ContentView>
    <ContentView prism:Navigation.CanNavigate="False">
        <ContentView>
            <Button Text="Cannot Navigate" Command="{prism:GoBack}" /> 
        </ContentView>
    </ContentView>
</ContentView>

Prism.Wpf

  • #30: Removing from, or opting out of registration, in the IRegionNavigationJournal
  • #993: RemoveAll throws if KeepAlive is false
  • #1013: MEF DirectoryModuleCatalog - problem with diacritics since 6.3
  • #1120: Prism.Autofac RegisterTypeForNavigation issue
  • #1128: ViewModelLocator triggers in design mode
  • #1161: Ninject - Prism creating new view even if view exists in region
  • #1165: Change PopupWindowAction.CreateDefaultWindow to virtual
  • #1175: Upgraded to Unity 5 Breaking
  • #1211: Upgrade to CommonServiceLocator 2.0.1 Breaking
  • #1217: Add OnInitialized methdo to bootstrapper
  • #1242: AssemblyResolver - File path in FileNotFoundException
  • #1261: ListDictionary TKey and TValue same type Breaking
  • #1264: Is it possible to provide a type safe way to read parameter
  • #1321: Added support for regions targeting FrameworkContentElements
  • #1327: Include correct version of System.Windows.Interactivity
  • #1414: BREAKING Changed from Unity NuGet to Unity.Container
  • #1463: DryIoc Default Rules Change. By default DryIoc will attempt to resolve types based on an available constructor with resolvable types. Secondary registrations will now replace any initial registration by default.
  • #1476: Module Alignment BREAKING
    • Moved Exceptions to Prism.Core
    • Moved ModuleInfo to Prism.Core
    • Moved IModuleCatalogItem to Prism.Core
    • Moved IModuleInitializer to Prism.Core
    • Moved IModuleManager to Prism.Core

New PrismApplication Base Class

The Bootstrapper has been marked obsolete and it is recommended to use the PrimsApplication class going forward. This results in less code to get started, and an easier and more intuitive API.

Added new Prism.Ioc namespace to handle DI container abstractions. Interacting with the container is now done via the IContainerProvider and the IContainerRegistry interfaces. The IContainerProvider interfac...

Read more

7.1.0-pre1

02 Apr 17:39
0c75227
Compare
Choose a tag to compare
7.1.0-pre1 Pre-release
Pre-release

General Notes

Note that all Prism applications using Unity will need to uninstall Unity due to a change from depending on Unity nuget to Unity.Container. This change reduces the number of Unity assemblies being referenced by 75% and removes an obscure secondary reference to CommonServiceLocator for WPF applications.

Prism 7.1 is NOT compatible with the Xamarin Forms WPF backend.

Prism.Core

  • #1348: Navigation Alignment - moved all navigation interfaces into Prism Core (currently hidden from WPF)

Prism.Forms

  • #1348: Navigation alignment
    • Added INavigationParameters
    • Added INavigationParametersInternal
    • Added INavigationResult
    • Convert all methods using NavigationParameters to use the new INavigationParameters BREAKING
    • Changed Task INavigationService.NavigateAsync to Task<INavigationResult> INavigationService.NavigateAsync
    • Changed Task<bool> INavigationService.GoBackAsync to Task<INavigationResult> INavigationService.GoBackAsync BREAKING
  • #1347: ContainerProvider - Allows Declaring Types in XAML that require the Container to Resolve them
  • #1353: NavigationFrom not called when navigate to different Hamburger Menu Page
  • #1354: INavigationAware methods are not called on children of a CarouselPage
  • #1414: BREAKING Changed from Unity NuGet to Unity.Container

ContainerProvider

The Container Provider now allows types like ValueConverters to include Dependency Injection of Types/Services in the ctor, and allows the converter to be declared in XAML

namespace Contoso.Converters
{
    public class MyValueConverter : IValueConverter
    {
        private ILoggerFacade _logger { get; }

        public MyValueConverter(ILoggerFacade logger)
        {
            _logger = logger;
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _logger.Log("Converting value", Category.Debug, Priority.None);
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _logger.Log("Converting Value Back...", Category.Debug, Priority.None);
            return value;
        }
    }
}

This can then be used in XAML using the ContainerProvider as follows:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:ioc="clr-namespace:Prism.Ioc;assembly=Prism.Forms"
             xmlns:converters="using:Contoso.Converters"
             x:Class="Contoso.Views.ViewA">
    <ContentPage.Resources>
        <ResourceDictionary>
            <ioc:ContainerProvider x:TypeArguments="converters:MyValueConverter" x:Key="myValueConverter" />
        </ResourceDictionary>
    </ContentPage.Resources>
    <Entry Text="{Binding Demo,Converter={StaticResource myValueConverter}}" />
</ContentPage>

Prism.WPF

  • #30: Removing from, or opting out of registration, in the IRegionNavigationJournal
  • #993: RemoveAll throws if KeepAlive is false
  • #1013: MEF DirectoryModuleCatalog - problem with diacritics since 6.3
  • #1120: Prism.Autofac RegisterTypeForNavigation issue
  • #1128: ViewModelLocator triggers in design mode
  • #1161: Ninject - Prism creating new view even if view exists in region
  • #1165: Change PopupWindowAction.CreateDefaultWindow to virtual
  • #1175: Upgraded to Unity 5 Breaking
  • #1211: Upgrade to CommonServiceLocator 2.0.1 Breaking
  • #1217: Add OnInitialized methdo to bootstrapper
  • #1242: AssemblyResolver - File path in FileNotFoundException
  • #1261: ListDictionary TKey and TValue same type Breaking
  • #1264: Is it possible to provide a type safe way to read parameter
  • #1321: Added support for regions targeting FrameworkContentElements
  • #1327: Include correct version of System.Windows.Interactivity
  • #1414: BREAKING Changed from Unity NuGet to Unity.Container

New PrismApplication Base Class

The Bootstrapper has been marked obsolete and it is recommended to use the PrimsApplication class going forward. This results in less code to get started, and an easier and more intuitive API.

Added new Prism.Ioc namespace to handle DI container abstractions. Interacting with the container is now done via the IContainerProvider and the IContainerRegistry interfaces. The IContainerProvider interface is used to resolve services from the container. The IContainerRegistry is used to register types with the container. Access to the actual DI container can be achieved by using the GetContainer() extension method off of the IContainerRegistry and IContainerProvider interfaces.

7.0.0 SR1 for Xamarin Forms

22 Jan 21:53
7c96c9a
Compare
Choose a tag to compare

For apps that have not upgraded from 6.X to 7.0, please be sure to read the initial 7.0 release notes for a complete listing of changes.

This will break users who have existing implementations of IModule. Note that Initialize has been completely removed. All Initialization logic should be moved to OnInitialized. Any services that need to be resolved can now be resolved using IContainerProvider in OnInitialized.

  • #1308: Updates BindableBase to use EqualityComparer in SetProperty
  • #1333: Select tabs when navigating from a MasterDetailPage and reusing the TabbedPage
  • #1338: BREAKING CHANGE Changes IModule.OnInitialized() => IModule.OnInitialized(IContainerProvider)
  • #1342: BREAKING CHANGE Removes IModule.Initialize

Prism 7 for Xamarin Forms

12 Jan 04:31
0c2d11f
Compare
Choose a tag to compare

General Notes

Before upgrading from Prism 6.3, please be sure to read through the release notes as there are several major and breaking changes. This release is only for Prism Core and Prism for Xamarin Forms ONLY.

Ninject Support

Ninject has been removed as a supported DI Container for Prism Forms due to compatibility issues with Ninject on iOS and Android.

Prism Core

  • .NET Standard Support

  • Added method to clear all errors on ErrorsContainer

  • Removed requirement for parameter in delegate definition of DelegateCommand.ObservesCanExecute Breaking
    Example:
    Old (v6.3): ObservesCanExcute((**vm**) => Property)
    New (v7.0): ObservesCanExecute(() => Property)

  • Add capability to DelegateCommand's ObservesProperty to observe properties of complex types
    Example:
    ObservesProperty(() => Property.NestedProperty.NestedPoperty)

Prism Forms

  • #650: Navigating between Tabs Breaking

  • #683: .NET Standard support

  • #765: Deep linking within a NavigationPage results in an incorrect ContentPage Title on Android

  • #921: Add ability to Remove pages from the navigation stack

  • #946: Support designating useModalNavigation for specific segments in Uri navigation

  • #1007: Re-license to MIT, following the Microsoft led projects

  • #1008: NavigationParameters: Not possible to specify parent type as generic parameter T

  • #1109: Retrieve current URI from Prism Xamarin.Forms NavigationService

  • #1111: Include pdb file in nuget package

  • #1024: XF: NavigationService swallowing Exceptions

  • #1025: Xamarin.Forms deprecated the Device.OS property in favor of the RuntimePlatform property. The following changes were made to accommodate these changes:
    IDeviceService

  • deprecated OnPlatform methods

  • added DeviceRuntimePlatform property - this mimics the XF API and returns a string

  • added RuntimePlatform property which returns an Enum of type RuntimePlatform and wraps the XF string-based values

  • #1027: Support macOS

  • #1044: When Detail of MasterDetailPage is null, Modal Navigation is possible

  • #1045: When calling NavigateAsync with NavigationPage, old page's Destroy on the stack is not called

  • #1046: When calling DeepLink from Navigation Stack, the second page becomes Modal navigation

  • #1054: When deep linking within NavigationPage, page order is reversed

  • #1063: Master of MasterDetailPage will not be destroyed

  • #1074: Optimize Xamarin Forms DryIoc adapter performance

  • #1085: Error occurs if null path is specified in EventToCommandBehavior

  • #1089: DebugLogger does not work in nuget-package

  • #1099: Introduce a Behavior factory into the navigation service

  • #1132: Prism Forms Modularity extension methods

  • #1133: IModuleCatalog AddModule returns wrong type

  • #1139: Modularity Enhancements

  • #1175: Upgraded to Unity 5 Breaking

  • #1076: IActiveAware not working when ContentPage (as child of a TabbedPage) is wrapped into a NavigationPage

  • #1166: Custom NavigationPage is not working properly Prism 7

  • #1187: Change TabbedPage navigation behavior Breaking

  • #1198: Rename IApplicationLifecycle to IApplicationLifecycleAware Breaking

  • #1200: Add GoBackToRoot method

  • #1232: PageNavigationService should check for MultiPage Parent

  • #1225: OnNavigatedTo Contains Extra Parameter

  • #1254: remove support for DependenyService autoresolution Breaking

  • #1286: Adding modules to Prism in newest PR version

  • #1325: Removes support for Ninject due to container incompatibility with iOS and Android

  • added IPageLifecycleAware and PageLifecycleAwareBehavior to enable responding to the Page's Appearing and Disappearing events

Container Extensions

  • deprecated the RegisterTypeForNavigationOnPlatform signature that requires explicit platform parameters
  • added new signature that accepts new IPlatform objects
    Example:
Container.RegisterForNavigationOnPlatform<MainPage, MainPageViewModel>("Main", 
	new Platform<MainPage_Android>(RuntimePlatform.Android),
	new Platform<MainPage_iOS>(RuntimePlatform.iOS));

PrismApplication API Changes - BREAKING

Added new Prism.Ioc namespace to handle DI container abstractions. Interacting with the container is now done via the IContainerProvider and the IContainerRegistry interfaces. The IContainerProvider interface is used to resolve services from the container. The IContainerRegistry is used to register types with the container. Access to the actual DI container can be achieved by using the GetContainer() extension method off of the IContainerRegistry and IContainerProvider interfaces.

Notable changes:

  • Removed ModuleCatalog property
  • Changed signature of ConfigureModuleCatalog() to ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
  • Changed signature of RegisterTypes() to RegisterTypes(IContainerRegistry containterRegistry)
  • Removed CreateContainer() method
  • Removed CreateNavigationService() method
  • Removed CreateLogger() method
  • Removed CreateModuleManager() method
  • Removed CreateModuleCatalog() method
  • Changed order of application initialization process (platform specific types are registered before application types)
  • Container property is now of type IContainerProvider
  • Renamed ConfigureContainer to RegisterRequiredTypes(IContainerRegistry containterRegistry)
  • Renamed RegisterTypeForNavigation to RegisterForNavigation

IModule API Changes - BREAKING

  • Obsolete Initialize() method - move all existing code into RegisterTypes and OnInitialized methods
  • Added RegisterTypes(IContainerRegistry containerRegistry) method - used to register types with the container
  • Added OnInitialized() method - used to perform any action after the module has been created, and types have been registered with the container.

ModuleInfo API Changes - BREAKING

  • Removed defaut ctor
  • Changed order of ctor parameters from ModuleInfo(Name, ModuleType, Mode) to ModuleInfo(ModuleType, Name, Mode)

TabbedPage Navigation Behavior Change - BREAKING

Current Behavior (v6.3.0)

NavigateAsync("TabbedPage/ViewA/ViewB") will select the tab ViewA in the TabbedPage if it exists, then continue navigating. If ViewA does not exist as a tab, then you will continue to navigate as expected.

NavigateAsync("TabbedPage/NavigationPage/ViewA/ViewB") would search the TabbedPage for the first instance of a tab that was a NavigationPage, then navigate within the Navigation page the remaining ViewA and ViewB pages. This provided the ability to deep link into a tab's nested navigation page, but there was no way to opt-out of this behavior.

Also, the INavigationAware methods did not get called to all tabs meaning that you would be responsible for forwarding any parameters to all your tabs.

New Behavior

NavigateAsync("TabbedPage/ViewA/ViewB") will no longer select any tabs, but rather continue processing the navigation as separate pages on the navigation stack.

If you wish to select a tab, you will now use a parameter called "selectedTab" to indicate which tab you would like to select.

NavigateAsync("TabbedPage?selectedTab=MiddleTab/ViewA/ViewB")

This will navigate to the TabbedPage, selected the "MiddleTab" and continue navigating ViewA and ViewB onto the navigation stack.

For tabs that are wrapped inside a NavigationPage, you do not need to change anything. The syntax is the same. This will search each tab to see if it is a navigation page and if the CurrentPage of the NavigationPage matches "MiddleTab", the tab will be selected. This is much more flexible than the existing behavior as before it would take the first instance of the NavigationPage found. Now you can choose which tab exactly.

There is a constant in the KnownNavigationParameters called SelectedTab that you can use instead of a string.

NavigateAsync($"TabbedPage?{KnownNavigationParameters.SelectedTab}=MiddleTab")

Some INavigationAware methods are now fired on all Tabs:

  • OnNavigatingTo will be invoked on the TabbedPage and ALL TABS.
  • OnNavigatedTo will be invoked on the TabbedPage and only the SELECTED TAB.
  • OnNavigatedFrom will be invoked on the TabbedPage and only the SELECTED TAB.

Note: the parameter key selectedTab is now a reserved parameter name. Similar to a reserved keyword in C#. If you use this in your app as a key, you may experience undesired behavior.

Note: At this time there is no native support for deep linking into a Tab that is a navigation page. Please let me know if you need this functionality.

Dynamic Tab Generation

You can now dynamically create tabs when navigating to a TabbedPage by using the KnownNavigationParameters.CreateTab constant or by using the "createTab" parameter name.
_navigationService.NavigateAsync("MyTabbedPage?createTab=ViewA&createTab=ViewB");
This will create a TabbedPage and then create two tabs, ViewA and ViewB.
To create a tab that wraps a page in a NavigationPage, simply denote this as a nested hierarchy using the | character.
_navigationService.NavigateAsync("MyTabbedPage?createTab=NavigationPage|ViewA");

Remove pages from navigation stack

This feature allows you to remove pages form the navigation stack of a NavigationPage while at the same time navigating to a new page. For each page you wish to remove, prefix your navigation path with ../.

Example
Our app requires a user to login in order to edit "User" profile information. This will require the user to be prompted to login and then once successful continue to edit the profile. This leaves us with the following navigation stack:

"NavigationPage/UserList/UserDetails/LoginPage/EditUser"

If we were to hit the back button from the EditUser page, we would be returned to the LoginPage. This is not the desired experience. Instead, we want to go back to the UserDetails which was just updated. To achieve...

Read more