Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Xamarin.Forms 1.1.0.6201 Released!

$
0
0

Xamarin.Forms 1.1.0.6201 release is here!

Get it on nuget! https://www.nuget.org/packages/Xamarin.Forms/1.1.0.6201

Yes you read that right, we have fixed our version numbering! Thank you to those who pointed it out. Versions are now Major.Minor.Patch.Build (though build wont symbolize a lot to you). This fix is largely based on feedback from you lovely folks, it does a lot of work to open up and make the renderer API's much much MUCH more consistent cross platform. This means you shouldn't need to learn as many individual platform quirks to write a renderer. However as a side effect this means most/all existing custom renderers will need some minor updating. We will help you if you have any issues, but really the changes are pretty minor (mostly naming).

The current numbering policy we are going with is as follows:

  • Major - Incremented when backwards compat for core is broken for previous versions
  • Minor - Major changes (functional) are added/modified or renderer API's are changed. (Renderer API's will be promoted to a Major soon)
  • Patch - Minor changes/bug fixes
  • Build - Monotonically increasing (though not always by 1, depends how many internal releases we do).

The next release will be 1.1.1

Release Notes

WARNING: Breaking change to the renderer API in this release.

Major Changes:

  • Renderer API's have been updated to be made more consistent (details below).
  • ModifierType has been removed (unused data type).

Release Features:

  • TableView.Root is marked as content and can now be set implicitly with XAML
  • Android MasterDetailPage now uses true DrawerLayout.
  • XAML now supports OnIdiom for conditional phone/tablet layouts.
  • TapGestureRecognizers now support Commanding and can be used from XAML.
  • Binding now additionally has an empty constructor to allow more usage from XAML.
  • ListView.GroupDisplayBinding and GroupShortNameBinding can now accept a regular string in XAML: <ListView GroupDisplayBinding="My.Path" />

Bug Fixes:

  • Entry keyboard updates property on iOS now.
  • NullReferenceException on iOS 6.1 fixed.
  • The Expression-based SetBinding overload's stringFormat parameter now works as expected.
  • SearchBar no longer requires API 16 on Android.
  • Android toolbar now works correctly for ToolbarItems on navigation pages.
  • EntryCell.IsEnabled now works.
  • UriImageSource.Uri no longer throws exceptions when null.
  • Android should no longer use the incorrect context after context recreation events.

Renderer API Changes:

  • Model renamed to Element (and all references updated).
  • Most renderers now subclass from ViewRenderer on all platforms.
  • OnElementPropertyChanged replaces OnModelPropertyChanged.
  • OnElementChanged replaces OnModelSet/OnModelChanged.
  • Windows Phone renderers are now public.
  • Most renderers now subclass generic super-class (no casting needed).
  • Other minor changes (see porting guide on forums).

Renderer Porting Guide

Porting your renderers will generally be fairly easy. Let's look at an iOS renderer to start with. Let's just look at a before and after to see the changes.

Before:

    public class MyCustomRenderer : NativeRenderer
    {
        protected override void OnModelSet (VisualElement model)
        {
            base.OnModelSet (model);

            SetNativeControl (new UIMyCustomView (RectangleF.Empty));

            UpdateSomething ();
        }

        protected override void OnHandlePropertyChanged (object sender, PropertyChangedEventArgs e)
        {
            base.OnHandlePropertyChanged (sender, e);

            if (e.PropertyName == MyCustomView.SomethingProperty.PropertyName)
                UpdateSomething ();
        }

        void UpdateSomething ()
        {
            ((UIMyCustomView)Control).Something = ((MyCustomView)Element).Something;
        }

After:

    public class MyCustomRenderer : ViewRenderer<MyCustomView, UIMyCustomView>
    {
        protected override void OnElementChanged (ElementChangedEventArgs<MyCustomView> e)
        {
            base.OnElementChanged (e);

            if (e.OldElement == null) {
                // perform initial setup
                SetNativeControl (new UIMyCustomView (RectangleF.Empty));
            }

            UpdateSomething ();
        }

        protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged (sender, e);

            if (e.PropertyName == MyCustomView.SomethingProperty.PropertyName)
                UpdateSomething ();
        }

        void UpdateSomething ()
        {
            Control.Something = Element.Something;
        }

As we can see. OnModelSet has been replaced with OnElementChanged. This replacement method might be called multiple times if the renderer gets re-used with a different element. You need to therefor handle this case correctly. Currently this only happens on Android, but we will be adding it to all platforms as performance tuning continues.

Further OnHandlerPropertyChanged has been renamed OnElementPropertyChanged, this is now consistent cross all three platforms. And on iOS you can see that the ViewRenderer is now generic and thus no casting is needed to the types you are expecting.

If you have any issues at all with the porting of your renderers to the new release, please feel free to post here. We apologize for the breaking change, however it was clear that this needed to happen based on feedback. Thank you all for your hard work and comments :)


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>