All Projects → AndreiMisiukevich → Cardview

AndreiMisiukevich / Cardview

Licence: mit
CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms

Projects that are alternatives of or similar to Cardview

Prism.plugin.popups
This provides extensibility for Prism.Forms INavigationService to handle Popup Views
Stars: ✭ 149 (-74.62%)
Mutual labels:  hacktoberfest, xamarin-forms
React Spring Slider
A slider component for react
Stars: ✭ 118 (-79.9%)
Mutual labels:  hacktoberfest, carousel
Xamarin.forms
Xamarin.Forms Official Home
Stars: ✭ 5,485 (+834.41%)
Mutual labels:  hacktoberfest, xamarin-forms
Hotreload
Xamarin.Forms XAML hot reload, live reload, live xaml
Stars: ✭ 407 (-30.66%)
Mutual labels:  hacktoberfest, xamarin-forms
TravellingApp
Xamarin.Forms goodlooking UI sample using the new CarouselView.
Stars: ✭ 52 (-91.14%)
Mutual labels:  carousel, xamarin-forms
Xamarin.forms.mocks
Library for running Xamarin.Forms inside of unit tests
Stars: ✭ 179 (-69.51%)
Mutual labels:  hacktoberfest, xamarin-forms
Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+1042.93%)
Mutual labels:  hacktoberfest, xamarin-forms
DrinksGalleryApp
Xamarin.Forms goodlooking UI sample using the new CarouselView (Parallax).
Stars: ✭ 51 (-91.31%)
Mutual labels:  carousel, xamarin-forms
Open Source Xamarin Apps
📱 Collaborative List of Open Source Xamarin Apps
Stars: ✭ 318 (-45.83%)
Mutual labels:  hacktoberfest, xamarin-forms
Prism
Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Xamarin Forms, and Uno / Win UI Applications..
Stars: ✭ 4,842 (+724.87%)
Mutual labels:  hacktoberfest, xamarin-forms
Laravel Telescope Toolbar
A toolbar for Laravel Telescope, based on the Symfony Web Profiler.
Stars: ✭ 578 (-1.53%)
Mutual labels:  hacktoberfest
Sunpy
SunPy - Python for Solar Physics
Stars: ✭ 577 (-1.7%)
Mutual labels:  hacktoberfest
Vue Nodegui
Build performant, native and cross-platform desktop applications with native Vue + powerful CSS like styling.🚀
Stars: ✭ 575 (-2.04%)
Mutual labels:  hacktoberfest
Ffsend
📬 Easily and securely share files from the command line. A fully featured Firefox Send client.
Stars: ✭ 5,448 (+828.11%)
Mutual labels:  hacktoberfest
Algorithms
A repository of different Algorithms and Data Structures implemented in many programming languages.
Stars: ✭ 578 (-1.53%)
Mutual labels:  hacktoberfest
Simple Slider
🎠 The 1kb JavaScript Carousel
Stars: ✭ 583 (-0.68%)
Mutual labels:  carousel
Imgcat
It's like cat, but for images.
Stars: ✭ 577 (-1.7%)
Mutual labels:  hacktoberfest
Sentinelsat
Search and download Copernicus Sentinel satellite images
Stars: ✭ 576 (-1.87%)
Mutual labels:  hacktoberfest
Telegram History Dump
Backup Telegram chat logs using telegram-cli
Stars: ✭ 574 (-2.21%)
Mutual labels:  hacktoberfest
Dataverse
Open source research data repository software
Stars: ✭ 586 (-0.17%)
Mutual labels:  hacktoberfest

GIF

CardsView CarouselView CoverFlowView CubeView
ScaleFactor & OpacityFactor ScaleFactory & OpacityFactor [2] TabsControl

Setup

  • Available on NuGet: CardsView NuGet
  • Add nuget package to your Xamarin.Forms .NETSTANDARD/PCL project and to your platform-specific projects
  • Add (AFTER Forms.Init(...)):
    • CardsViewRenderer.Preserve() AppDelegate in FinishedLaunching for iOS
    • CardsViewRenderer.Preserve() MainActivity in OnCreate for Android
Platform Version
Xamarin.iOS iOS 7+
Xamarin.Mac All
Xamarin.Android API 15+
Windows 10 UWP 10+
Tizen 4.0+
Gtk All
WPF .NET 4.5
.NET Standard 2.0+

C#:

-> Create CardsView and setup it

var cardsView = new CardsView
{
    ItemTemplate = new DataTemplate(() => new ContentView()) //your template
};
cardsView.SetBinding(CardsView.ItemsSourceProperty, nameof(PanCardSampleViewModel.Items));
cardsView.SetBinding(CardsView.SelectedIndexProperty, nameof(PanCardSampleViewModel.CurrentIndex));

-> Optionaly you can create ViewModel... or not... as you wish

-> Indicators bar (For CarouselView, perhaps). It's easy to add indicators -> Just add IndicatorsControl into your carouselView as a child view.

carouselView.Children.Add(new IndicatorsControl());

XAML:

<cards:CarouselView 
    ItemsSource="{Binding Items}"
    SelectedIndex="{Binding CurrentIndex}">
    <cards:CarouselView.ItemTemplate>
        <DataTemplate>
            <ContentView>
                <Frame 
                    VerticalOptions="Center"
                    HorizontalOptions="Center"
                    HeightRequest="300"
                    WidthRequest="300"
                    Padding="0" 
                    HasShadow="false"
                    IsClippedToBounds="true"
                    CornerRadius="10"
                    BackgroundColor="{Binding Color}">
                    
                    <Image Source="{Binding Source}"/> 
                    
                </Frame>
            </ContentView>
        </DataTemplate>
    </cards:CarouselView.ItemTemplate>

    <controls:LeftArrowControl/>
    <controls:RightArrowControl/>
    <controls:IndicatorsControl/>
</cards:CarouselView>

Also you are able to manage IndicatorsControl appearing/disappearing. For example if user doesn't select new page during N miliseconds, the indicators will disappear. Just set ToFadeDuration = 2000 (2 seconds delay before disappearing) Yoy manage LeftArrowControl and RightArrowControl as well as IndicatorsControl (ToFadeDuration is presented too).

Indicators styling:

 <ContentPage.Resources>
    <ResourceDictionary>
        <Style x:Key="ActiveIndicator" TargetType="Frame">
            <Setter Property="BackgroundColor" Value="Red" />
        </Style>
        <Style x:Key="InactiveIndicator" TargetType="Frame">
            <Setter Property="BackgroundColor" Value="Transparent" />
            <Setter Property="OutlineColor" Value="Red" />
        </Style>
    </ResourceDictionary>
</ContentPage.Resources>

... 

<controls:IndicatorsControl ToFadeDuration="1500"
          SelectedIndicatorStyle="{StaticResource ActiveIndicator}"
          UnselectedIndicatorStyle="{StaticResource InactiveIndicator}"/>

if you want to add items directly through xaml

...
    <cards:CarouselView.ItemsSource>
            <x:Array Type="{x:Type View}">
                <ContentView>
                    <Image Source="yourImage.png"/>
                </ContentView>
                <RelativeLayout>
                    <Button Text="Click" />
                </RelativeLayout>
                <StackLayout>
                    <Label Text="any text"/>
                </StackLayout>
            </x:Array>
    </cards:CarouselView.ItemsSource>
...

if you want to achieve scale or opacity changing effects for side views (ScaleFactor & OpacityFactor), you should mange corresponding properties in processor and pass them to view constructor via x:Arguments:

<ContentPage 
    ...
    xmlns:cards="clr-namespace:PanCardView;assembly=PanCardView"
    xmlns:proc="clr-namespace:PanCardView.Processors;assembly=PanCardView">

...

<cards:CoverFlowView 
      PositionShiftValue="145"
      ItemsSource="{Binding Items}">

      <x:Arguments>
          <proc:CoverFlowProcessor ScaleFactor="0.75" OpacityFactor="0.25" />
      </x:Arguments>

  <cards:CoverFlowView.ItemTemplate>
      <DataTemplate>
         <Frame
             Margin="80">
               
              ....

          </Frame>
      </DataTemplate>
  </cards:CoverFlowView.ItemTemplate>

</cards:CoverFlowView>

...

-> If you want to customize indicators, you need set SelectedIndicatorStyle and/or UnselectedIndicatorStyle, or you are able to extend this class and override several methods. Also you can customize position of indicators (You need to set Rotation / AbsoluteLayout Flags and Bounds etc.)

This class is describing default indicators styles (each default indicator item is Frame) https://github.com/AndreiMisiukevich/CardView/blob/master/PanCardView/Styles/DefaultIndicatorItemStyles.cs

MORE SAMPLES you can find here https://github.com/AndreiMisiukevich/CardView/tree/master/PanCardViewSample

Custom Animations

You are able to create custom animations, just implement IProcessor or extend existing processors (change animation speed or type etc.) https://github.com/AndreiMisiukevich/CardView/tree/master/PanCardView/Processors

Workarounds

-> If you want to put your cardsView/carouselView INTO a TabbedPage on Android:

  1. Add an event handler for the UserInteraction event
  2. On UserInteractionStatus.Started: Disable TabbedPage Swipe Scrolling
  3. On UserInteractionStatus.Ending/Ended: Enabled TabbedPage Swipe Scrolling

Example:

  1. TabbedPage:
public partial class TabbedHomePage : Xamarin.Forms.TabbedPage
{
    public static TabbedHomePage Current { get; private set; }

    public TabbedHomePage()
    {
        Current = this;
    }

    public static void DisableSwipe()
    {
        Current.On<Android>().DisableSwipePaging();
    }
    
    public static void EnableSwipe()
    {
        Current.On<Android>().EnableSwipePaging();
    }
}
  1. Page with CardsView/CarouselView:
public PageWithCarouselView()
{
    InitializeComponent();

    carouselView.UserInteracted += CarouselView_UserInteracted;
}

private void CarouselView_UserInteracted(PanCardView.CardsView view, PanCardView.EventArgs.UserInteractedEventArgs args)
{
    if (args.Status == PanCardView.Enums.UserInteractionStatus.Started)
    {
        TabbedHomePage.DisableSwipe();
    }
    if (args.Status == PanCardView.Enums.UserInteractionStatus.Ended)
    {
        TabbedHomePage.EnableSwipe();
    }
}

-> If you don't want to handle vertical swipes or they interrupt your scrolling, you can set IsVerticalSwipeEnabled = "false"

-> If all these tricks didn't help you, you may use IsPanInteractionEnabled = false This trick disables pan interaction, but preserve ability to swipe cards.

-> If you get crashes during ItemsSource update, try to add/set items in Main Thread (Device.BeginInvokeOnMainThread)

-> GTK use click / double click for forward/back navigation.

Check source code for more info, or just ask me =)

Full documentation

https://github.com/AndreiMisiukevich/CardView/tree/master/docs

License

The MIT License (MIT) see License file

Contribution

Feel free to create issues and PRs 😃

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].