Skip to content

Releases: PrismLibrary/Prism

7.2.0.1367

24 Jul 16:56
128328a
Compare
Choose a tag to compare

Summary

Prism 7.2 represents some major fundamental changes. Be sure to read the release notes in full. In addition to adding several new great API's there are some major breaking changes particularly for Xamarin.Forms developers.

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
  • #1796: Optimize Weak DelegateReference for EventAggregator

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
  • #1754: Fully support bindings for XAML Navigation
  • #1757: Add Automatic View Registration
  • #1806: Removes FastExpressionCompiler for DryIoc due to iOS incompatibility
  • #1814: Adding DialogService
  • #1822: Enhancing Modal Logic to reduce/eliminate need to specify modal navigation when Navigating Back. Enhances Navigation Exception Messaging with new NavigationException class
  • #1842: Fixes reparenting bug for DialogService in XF 4.X on Android with Screen Reader enabled

View/ViewModel Initialization

After numerous user survey's and interviews it became apparent that the intent of INavigatingAware had been become unclear and that users were actually overwhelmingly asking for a breaking change. INavigatingAware is no longer supported. For those who may be using OnNavigatingTo with INavigationAware this will be most impactful as a behavior change as INavigatingAware has been removed from INavigationAware meaning that it will no longer be called. For those who have implemented INavigatingAware directly you will see a build error. The impact should be minimal by simply renaming all instances of INavigatingAware to Initialize.

Using IAutoInitialize

IAutoInitialize is designed for those cases where you are passing objects around. By default we do a Non-Case-Sensitive lookup between the Navigation|Dialog Parameters and the Properties in your ViewModel. If one is found we will automatically try to set the property for you.

_navigationService.NavigateAsync("ViewB" ("title", "Hello World"), ("fooBar", "some other value"));

public class ViewBViewModel : IAutoInitialize
{
    public string Title { get; set; }
    public string FooBar { get; set; }
}

In the above example your ViewModel will be initialized with the values passed in the NavigationParameters or DialogParameters. If these are static variables (meaning the won't change during the lifecycle of your View/ViewModel you would not need to implement INotifyPropertyChanged for them.

public class ViewBViewModel
{
    [AutoInitialize(true)
    public string Title { get; set; }

    [AutoInitialize("fooBar")
    public string Foo { get; set; }
}

In this example you'll notice that we have some slight variations where we have added NavigationParameter attributes. The attributes allow you to decorate your properties to make them Required or specify a different name that you will use in your NavigationParameters. Note that if you make a property Required and you fail to pass the parameter this will throw an Exception that you will need to check for in the NavigationResult.

Automatic View Registration

Automatic Registration can be used for either an Application or Module. Note that there is an optional Automatic property. When Automatic is set to true Prism will not look for any attributes but will simply look for any contained types that are a Page type. If there is a Page type it will automatically be registered.

[AutoRegisterForNavigation]
public class App : PrismApplication
{
}

[AutoRegisterForNavigation(Automatic = true)]
public class AwesomeModule : IModule
{
}

Using the Dialog Service

The Dialog Service operates by updating the current ContentPage's layout and placing a new View over the top of the existing Content, and then unwinding the changes back to it's original state. This gives the appearance of a Popup similar to what you may see when using Prism.Plugin.Popups but is driven entirely by native Xamarin.Forms.

Custom Alert Custom Dialog
Custom Alert Custom Dialog

The Dialog Service provides for a lot of flexibility and customization to help you produce dialogs that look and feel like they belong in your app. This includes an ability to shift the position, change the mask color or provide an entire custom mask layer.

To Start you simply need to implement IDialogAware, and raise the RequestClose event when you are ready to close the dialog.

public class DemoDialogViewModel : BindableBase, IDialogAware, IAutoInitialize
{
    public DemoDialogViewModel()
    {
        CloseCommand = new DelegateCommand(() => RequestClose(null));
    }

    private string title = "Message";
    public string Title
    {
        get => title;
        set => SetProperty(ref title, value);
    }

    private string message;
    [AutoInitialize(true)] // Makes Message parameter required
    public string Message
    {
        get => message;
        set => SetProperty(ref message, value);
    }

    public DelegateCommand CloseCommand { get; }

    public event Action<IDialogParameters> RequestClose;

    public bool CanCloseDialog() => true;

    public void OnDialogClosed()
    {
        Console.WriteLine("The Demo Dialog has been closed...");
    }

    public void OnDialogOpened(IDialogParameters parameters)
    {
        // No need to do anything as IAutoInitialize will take care of what we need here...
    }
}
<?xml version="1.0" encoding="utf-8" ?>
<Grid xmlns="http://xamarin.com/schemas/2014/forms"
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
      xmlns:prism="http://prismlibrary.com"
      prism:ViewModelLocator.AutowireViewModel="True"
      prism:DialogLayout.RelativeWidthRequest="{OnIdiom Default=0.75, Desktop=0.5}"
      BackgroundColor="White"
      x:Class="HelloWorld.Views.DemoDialog">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <BoxView Color="Black" />
    <Label Text="{Binding Title}"
           Style="{DynamicResource TitleStyle}"
           Margin="20,5"
           TextColor="White" />

    <Label Text="{Binding Message}"
           Margin="20,0,20,10"
           Grid.Row="1" />

    <Button Text="Ok"
            Command="{Binding CloseCommand}"
            HorizontalOptions="Center"
            Margin="0,0,0,10"
            Grid.Row="2"/>
</Grid>

With your View and ViewModel created you now need to register the Dialog to use it. This can be registered in your App.xaml.cs or in a Module.

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

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
  • #1732: Updated .NET Core 3 DirectoryModuleCatalog
  • #1796: WeakDelegatesManager::RemoveListener performance
  • #1805: Attached RegionManager to Dialog by default
  • #1826: Using Enum for IDialogResult.Result

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 UserControl 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.micr...
Read more

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