17

Xamarin.Forms vertical Tabs and HorizontalListView drag and drop

 3 years ago
source link: https://www.sharpnado.com/xamarin-forms-vertical-tabs/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Xamarin.Forms vertical Tabs and HorizontalListView drag and drop

Tabs version 2.1.0 and HorizontalListView v1.8.1 are here \o/ (and also MaterialFrame v1.1.4)

logo.pnghttps://github.com/roubachof/Sharpnado.Tabs Sharpnado.Tabs.svglogo.pnghttps://github.com/roubachof/Sharpnado.HorizontalListView Sharpnado.Forms.HorizontalListView.svg

What's new?

Vertical Tabs

PR by @nor0x (Joachim Leonfellner).

PR

You can now change the orientation of the tabs to achieve vertical tabs.
It could be pretty convenient for landscape or tablet layout.

<sho:TabHostView x:Name="TabHostLogo"  
    Grid.Row="3"
    WidthRequest="200"
    HeightRequest="60"
    Margin="15"
    Padding="20,0"
    HorizontalOptions="Center"
    VerticalOptions="Start"
    BackgroundColor="{DynamicResource DynamicBottomBarBackground}"
    CornerRadius="30"
    IsSegmented="True"
    Orientation="Horizontal"
    Shades="{DynamicResource DynamicBottomTabsShadow}"
    TabType="Fixed">

You can find in the silly app (https://github.com/roubachof/Xamarin-Forms-Practices/blob/master/SillyCompany.Mobile.Practices/Presentation/Views/TabsLayout/SillyBottomTabsPage.xaml.cs) an example of dynamically adapting tabs orientation while switching from portrait to landscape:

vertical tabs gif

HorizontalListView runtime drag and drop animations

EnableDragAndDrop is now a bindable property, so you can enable it at runtime.

You can now also specify a custom animation when the EnableDragAndDrop is set to ture:

HorizontalListView.DragAndDropEnabledAnimationAsync = async (viewCell, token) =>  
{
    while (!token.IsCancellationRequested)
    {
        await viewCell.View.RotateTo(8);
        await viewCell.View.RotateTo(-8);
    }

    await viewCell.View.RotateTo(0);
};

will result in:

drag_enabled_animation.gif

You can decide to start the drag without long press on iOS thanks to the iOS specific property iOSDragAndDropOnPanGesture:

<sho:HorizontalListView  
    ...
    iOSDragAndDropOnPanGesture="True" />

Fixes

MaterialFrame v1.1.4

  • Fixes #16: issue with background color on android with Xamarin.Forms 5.0

Tabs

  • Fixes #20 #8: bad icon or text color when dynamically changing colors

Jean-Marie Alfonsi

I am a freelance developer since 2012 focusing primarly on Xamarin stuff: xamarin ios, xamarin android, xamarin forms.

Share this post


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK