• Stars
    star
    281
  • Rank 146,267 (Top 3 %)
  • Language
    C#
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ContextView for Xamarin.Forms

GIF

SideContextMenuView SwipeActionContextMenuView (Move to delete) SwipeActionContextMenuView (Autoclosing)

Setup

  • Available on NuGet: ContextViewCell NuGet
  • Add nuget package to your Xamarin.Forms .netStandard/PCL project and to your platform-specific projects (iOS and Android)
  • Call ContextMenuViewRenderer.Preserve() in AppDelagate for iOS and MainActivity for Android
Platform Version
Xamarin.iOS 8.0+
Xamarin.Android 15+

Samples

All samples are here: https://github.com/AndreiMisiukevich/ContextMenu/tree/master/ContextMenuSample/ContextMenuSample/Pages

Collection view is supported! XAML:

<CollectionView x:Name="CollectionView"
                    ItemsSource="{Binding Items}"
                    Margin="0, 5, 0, 0"
                    BackgroundColor="White">
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <context:SideContextMenuView IsAutoCloseEnabled="true">
                        <context:SideContextMenuView.View>
                            <Frame BackgroundColor="#512DA8"
                                   Margin="15,5"
                                   Padding="20"
                                   WidthRequest="{Binding Source={x:Reference CollectionView}, Path=Width, Converter={StaticResource MenuFitWidthConverter}, ConverterParameter='70'}"
                                   CornerRadius="10">
                                <StackLayout Orientation="Horizontal" 
                                             HorizontalOptions="FillAndExpand"
                                                                                Opacity="{Binding IsMuted, Converter={StaticResource IsMutedToOpacityConverter}}"
                                             Spacing="10">
                                    <Frame HeightRequest="80"
                                           WidthRequest="80"
                                           CornerRadius="40"
                                           Padding="0"
                                           VerticalOptions="CenterAndExpand"
                                           IsClippedToBounds="true">
                                        <Image Source="{Binding AvatarUrl}" 
                                               Aspect="AspectFill"/>
                                    </Frame>
                                    <StackLayout VerticalOptions="CenterAndExpand"
                                                 HorizontalOptions="CenterAndExpand"
                                                 Spacing="0">
                                        <Label Text="Chat with:"
                                               FontAttributes="Bold"
                                               TextColor="White"/>
                                        <Label Text="{Binding Name}" 
                                               FontSize="Large"
                                               TextColor="White"/>
                                    </StackLayout>
                                </StackLayout>                             
                            </Frame>
                        </context:SideContextMenuView.View>
                        <context:SideContextMenuView.ContextTemplate>
                            <DataTemplate>
                                <Frame Margin="0, 5"
                                       Padding="0"
                                       CornerRadius="10"
                                       IsClippedToBounds="true"
                                       BackgroundColor="Gold">
                                    <StackLayout 
                                             Padding="10, 5"
                                             Orientation="Horizontal"
                                             Spacing="10"
                                             Margin="0, 5">
                                        <ImageButton Source="trash.png" HeightRequest="60" WidthRequest="60" VerticalOptions="CenterAndExpand" HorizontalOptions="EndAndExpand" 
                                                     Command="{Binding BindingContext.DeleteCommand, Source={x:Reference CollectionView}}"
                                                     CommandParameter="{Binding .}"/>
                                        <ImageButton Source="mute.png" HeightRequest="60" WidthRequest="60" VerticalOptions="CenterAndExpand" HorizontalOptions="EndAndExpand" 
                                                     Command="{Binding BindingContext.MuteCommand, Source={x:Reference CollectionView}}"
                                                     CommandParameter="{Binding .}"/>
                                    </StackLayout>
                                </Frame>
                            </DataTemplate>
                        </context:SideContextMenuView.ContextTemplate>  
                    </context:SideContextMenuView>
            </DataTemplate>
        </CollectionView.ItemTemplate>
    </CollectionView>

Make sure your main view width equals list's width You can adjust it by binding

...
<CollectionView x:Name="Collection"
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <context:SideContextMenuView>
                    <context:SideContextMenuView.View>
                        <ContentView WidthRequest="{Binding Source={x:Reference Collection}, Path=Width}">
                            ...

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

License

The MIT License (MIT) see License file

Contribution

Feel free to create issues and PRs 😃

More Repositories

1

CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
C#
709
star
2

HotReload

Xamarin.Forms XAML hot reload, live reload, live xaml
C#
417
star
3

TouchEffect

UI-responsive touch effects for Xamarin.Forms
C#
197
star
4

ExpandableView

Expandable view for Xamarin.Forms
C#
175
star
5

CardView.MAUI

CardsView | CarouselView | CoverflowView | CubeView for .NET Maui
C#
87
star
6

OpenTok-Xamarin.Forms

Vonage | TokBox | OpenTok: Video/Audio Chat library for Xamarin.Forms
C#
81
star
7

XamarinFormsProfilePage

Xamarin.Forms Profile Page
C#
65
star
8

Xamarin.Forms.Vonage

C#
24
star
9

RawRows

C#
19
star
10

RangeSlider

C#
17
star
11

SideMenu

C#
17
star
12

SegmentedCircleView

SegmentedCircleView for xamarin forms
C#
10
star
13

BaseViewModel

BaseViewModel
C#
10
star
14

Instagramarin

Instagram Profile page UI challenge
C#
8
star
15

Xamarin.HybridWebView

Hybrid WebView for Xamarin applications
C#
7
star
16

GalleyFramework

C#
6
star
17

AvengersCards

Xamarin.Forms | CardsView | PancakeView
C#
6
star
18

TouchEffectSample

C#
6
star
19

Task-manager

Task manager on C# with charts of CP and Memory
C#
5
star
20

DB-ORM-DBMS

Own Database, own Object-Relational Mapping for work with it, own Database Management System. Only for education!
C#
5
star
21

Chatter

Chatter
C#
3
star
22

PanGestureRecognizerIssueReproduction

C#
3
star
23

HttpListenerSample

https://github.com/1iveowl/Simple-Http-Listener-PCL (Simple httplistener samples)
C#
3
star
24

vts-xamarin-ios

C#
3
star
25

FluentLayout

Xamarin.Forms Fluent Layout
C#
3
star
26

ZipCodeParser

C#
3
star
27

RangeSliderSample

Xamarin.Forms RangeSlider sample
C#
2
star
28

XCTValidatorDemo

C#
2
star
29

AvatarViewSample

C#
1
star