Swipe view in xamarin form

What is swipeview?

Swipeview is the container that hide menu. This menu will be visible by swipe gestures. This view takes less space due to which application become more aesthetic.

It has four properties

  • LeftItems
  • RightItems
  • TopItems
  • BottomItems
Below is example:


Let see the code:

Left Swipe

       <SwipeView>
                <SwipeView.LeftItems>
                    <SwipeItems>
                        <SwipeItem Text="Favorite" BackgroundColor="#068d94" IconImageSource="favorite.png"/>
                        <SwipeItem Text="Delete" BackgroundColor="#f9726b" IconImageSource="delete.png"/>
                    </SwipeItems>
                </SwipeView.LeftItems>
               
                <Frame CornerRadius="20" BackgroundColor="#FC7651" HasShadow="True">
                    <Grid HeightRequest="20"  BackgroundColor="#FC7651">
                        <Label Text="Swipe right"  HorizontalOptions="Center" VerticalOptions="Center" TextColor="White" FontSize="16" FontAttributes="Bold"/>
                    </Grid>
                </Frame>
      </SwipeView>

Right Swipe

        <SwipeView>
                <SwipeView.RightItems>
                    <SwipeItems>
                        <SwipeItem Text="Favorite" BackgroundColor="#068d94" IconImageSource="favorite.png"/>
                        <SwipeItem Text="Delete" BackgroundColor="#f9726b" IconImageSource="delete.png"/>
                    </SwipeItems>
                </SwipeView.RightItems>
               
                <Frame CornerRadius="20" BackgroundColor="#ffdb60" HasShadow="True">
                    <Grid HeightRequest="20"  BackgroundColor="#ffdb60">
                        <Label Text="Swipe left"  HorizontalOptions="Center" VerticalOptions="Center" TextColor="White" FontSize="16" FontAttributes="Bold"/>
                    </Grid>
                </Frame>
        </SwipeView>

Top Swipe

       <SwipeView>
                <SwipeView.TopItems>
                    <SwipeItems>
                        <SwipeItem Text="Favorite" BackgroundColor="#068d94" IconImageSource="favorite.png"/>
                        <SwipeItem Text="Delete" BackgroundColor="#f9726b" IconImageSource="delete.png"/>
                    </SwipeItems>
                </SwipeView.TopItems>
           
                <Frame CornerRadius="20" BackgroundColor="#42cfca" HasShadow="True">
                    <Grid HeightRequest="20"  BackgroundColor="#42cfca">
                        <Label Text="Swipe down"  HorizontalOptions="Center" VerticalOptions="Center" TextColor="White" FontSize="16" FontAttributes="Bold"/>
                    </Grid>
                </Frame>
       </SwipeView>

Bottom Swipe

       <SwipeView>
                <SwipeView.BottomItems>
                    <SwipeItems>
                        <SwipeItem Text="Favorite" BackgroundColor="#068d94" IconImageSource="favorite.png"/>
                        <SwipeItem Text="Delete" BackgroundColor="#f9726b" IconImageSource="delete.png"/>
                    </SwipeItems>
                </SwipeView.BottomItems>
             
                <Frame CornerRadius="20" BackgroundColor="#63322f" HasShadow="True">
                    <Grid HeightRequest="20"  BackgroundColor="#63322f">
                        <Label Text="Swipe up"  HorizontalOptions="Center" VerticalOptions="Center" TextColor="White" FontSize="16" FontAttributes="Bold"/>
                    </Grid>
                </Frame>
      </SwipeView>
I hope this post will help you.
Thanks for reading! :)

Comments

Popular posts from this blog

Push Notifications in .NET MAUI: A Comprehensive Guide

Explore the UI libraries available for .NET MAUI at no cost.

Push Notification using Firebase in xamarin form (Android and IOS)