Sharpnado.HorizontalListView 1.8: reveal animations

Sharpnado.HorizontalListView 1.8: reveal animations
WARNING the HorizontalListView has been renamed to CollectionView since version 2.0.
https://github.com/roubachof/Sharpnado.CollectionView

Version 1.8 breaking changes

Namespace changed from Sharpnado.Presentation.Forms.HorizontalListView to Sharpnado.HorizontalListView.

HorizontalListView, like MaterialFrame, Tabs and Shadows, now uses the same xml namespace: http://sharpnado.com.

Because of how works xaml compilation, you need to add code in your App.xaml.cs referencing the sharpnado assembly:

public App()
{
    InitializeComponent();

    Sharpnado.HorizontalListView.Initializer.Initialize(true, false);
    ...
}

What's new?

The star of the release is Jose Manuel Montero, he submitted two interesting PR.

Reveal animations

The first one included the idea to trigger animations when items where first added to the collection. He created also a simple sample add to demonstrate it (well you know me, I had to pump the sample with dark neomorphism silliness x).

I must say I had to reimplement the logic, but the idea was really brilliant!
You have now three Func that you can assign to any custom animation in the HorizontalListView:

public Func<ViewCell, Task> PreRevealAnimationAsync { get; set; }

public Func<ViewCell, Task> RevealAnimationAsync { get; set; }

public Func<ViewCell, Task> PostRevealAnimationAsync { get; set; }

You can now add simple reveal animations with little code in your view code-behind.

GridPage.xaml

<sho:HorizontalListView
    x:Name="HorizontalListView"
    CollectionPadding="10,30,10,75"
    CurrentIndex="{Binding CurrentIndex}"
    EnableDragAndDrop="True"
    InfiniteListLoader="{Binding SillyPeoplePaginator}"
    ItemHeight="120"
    ItemTemplate="{StaticResource DudeTemplateSelector}"
    ItemWidth="120"
    ItemsSource="{Binding SillyPeople}"
    ListLayout="{Binding Mode, Converter={converters:ListModeToListLayout}}"
    ListLayoutChanging="ListLayoutChanging"
    ScrollBeganCommand="{Binding OnScrollBeginCommand}"
    ScrollEndedCommand="{Binding OnScrollEndCommand}"
    TapCommand="{Binding TapCommand}" />

In the following example I flip the cell on the vertical axis and fade them for grid and linear layout. And flip the cell on the horizontal axis for vertical layout.

GridPage.xaml.cs

public GridPage()
{
    InitializeComponent();

    HorizontalListView.PreRevealAnimationAsync = async (viewCell) =>
        {
            viewCell.View.Opacity = 0;

            if (HorizontalListView.ListLayout == HorizontalListViewLayout.Vertical)
            {
                viewCell.View.RotationX = 90;
            }
            else
            {
                viewCell.View.RotationY = -90;
            }

            await Task.Delay(200);
        };

    HorizontalListView.RevealAnimationAsync = async (viewCell) =>
        {
            await viewCell.View.FadeTo(1);

            if (HorizontalListView.ListLayout == HorizontalListViewLayout.Vertical)
            {
                await viewCell.View.RotateXTo(0);
            }
            else
            {
                await viewCell.View.RotateYTo(0);
            }
        };
}

DragAndDropInfo

The DragAndDropStartCommand and DragAndDropEndedCommand commands will now pass as argument a DragAndDropInfo object:

public class DragAndDropInfo
{
    public int To { get; }

    public int From { get; }

    public object Content { get; }
}

Where Content is the view model bound to the cell.

Sharpnado.Presentation.Forms refactoring is over

The big sharpnado refactoring is over.

Each sharpnado's component has now its own repo.

  • Sharpnado.Tabs have now their own repo
  • Sharpnado.HorizontalListView have now its own repo
  • The Sharpnado.Presentation.Forms repo
    is now only a Home page for all the Sharpnado's component.

Latest version of Sharpnado.Presentation.Forms (v1.7.1) doesn't have all the sharpnado nugets up to date.

Version 1.8 will include latest components and won't require initialization code.

Preferred way of using packages is now to install only the one needed.