MyGit

3.0.0

Caliburn-Micro/Caliburn.Micro

版本发布时间: 2016-03-01 06:42:07

Caliburn-Micro/Caliburn.Micro最新发布版本:4.0.222+a53dd1fa1b(2022-09-06 19:59:44)

I'm really pleased to finally announce the release of Caliburn.Micro 3.0.0 after a long period of being in beta. The major features of 3.0.0 are Windows 10 / UWP and Xamarin.Forms support. With this release you can use your view models across all major platforms that support C#!

It's important to note this is a change in the major versions to there may be breaking changes.

Windows 10

The Windows 10 release follows along with the Windows 8.1 and Windows Phone 8.1 releases and combines them into a single library which is great from a maitenance perspective. If we need to start adding features specific to Phone, Xbox or even HoloLens they'll be done using feature detection via Windows.Foundation.Metadata.ApiInformation.

It includes conventions for new controls such as SplitView.

Also included is a sample showing how to set up a SplitView style app with the Frame not being the root visual but inside the ShellView, this sample is available at Hello UWP.

We now use the new open sourced XAML Behaviours package.

Windows 8.1

Windows 8.0

This release drops support for Windows 8.0 (different from Windows 8.1).

Xamarin Forms

This release brings support for Xamarin.Forms which in abstraction layer over the different UIs in iOS, Android and Windows Phone Silverlight (Windows 8 / 10 support coming later). What's really interesting is that it comes with it's own XAML syntax (not the same as Windows XAML but very similar), this means we can get a closer to standard Caliburn.Micro experience. I was pleasantly surprised by how much I got ported reasonable easy.

There are some limitations of the Xamarin.Forms flavour of of XAML, primarily there is no programmatic access to x:Name mean we cannot support named based conventions. We can still support attached properties such as cm:Message.Attach as well as convention based view / view model location.

<ListView ItemsSource="{Binding Features}" HasUnevenRows="True"
          cm:Message.Attach="[Event ItemSelected] = [ShowFeature($selectedItem)]">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <ContentView cm:View.Model="{Binding}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

Also included is the now standard navigation service and navigation helper methods

navigationService.For<ProductViewModel>()
    .WithParam(v => v.ProductId, 42)
    .Navigate();

A sample of this sort of app is can be found at Hello.Forms in the GitHub repository.

One of the more interesting features here is that Xamarin.Forms runs on top of the existing mobile platform (Xamarin.iOS, Xamarin.Android and Windows Phone Silverlight). This makes it the first version where two different platforms of Caliburn.Micro have to run side by side. We essentially have two instances of ViewModelLocator, one in Caliburn.Micro.ViewModelLocator for the current host platform and one at Caliburn.Micro.Xamarin.Forms.ViewModelLocator if Xamarin.Forms is present.

Xamarin.iOS and Xamarin.Android

This release primarily targets Xamarin.Forms, however work has been done to allow your view models to be reused within a Xamarin.iOS or Xamarin.Android applications with no support around binding or conventions.

These features will be added in later feature releases.

A sample of this sort of app is can be found at Hello.Xamarin in the GitHub repository.

Preserving State

One new feature in this release is the CachingFrameAdapter. This subclass of FrameAdapter (which implements INavigationService in WinRT platforms such as Windows 8.1, Windows Phone 8.1 and Windows 10) will cache internally view models and reuse them on the appropriate navigation. This allows scenarios where the built in NavigationCacheMode doesn't make sense but still preserve your view model state. A sample of this in action is available at Caliburn.Micro.State.

Other Changes

Breaking Changes

Thanks

Thank you to all who have contributed fixes, reported issues and generally feedback on the extended pre-release versions.

As well a bit thanks to Marker Metro who sponsored a lot of the time it took me to put this 3.0.0 release together.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2016-03-01发行的版本