Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Android.Views.View to my own class

$
0
0

Hi! I've been using a nuget package called MultiGestureView to get the long tap event on a viewcell but the event give me a Android.Views.View on the sender and dont know how to get the data from that. The binding context of the listview is a List of MyClass (for example)

XAML:

<ListView>
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <gesture:MultiGestureView LongPressed="Gesturev_LongPressed">

                        <Grid BackgroundColor="{Binding colorPrior}" TranslationX="{Binding PosX}">
                <!-- some data with bindings-->
                        </Grid>
                    </gesture:MultiGestureView>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

CS:

private void Gesturev_LongPressed(object sender, EventArgs e)
    {
        MyClass myClass = sender as MyClass;
    //I tried everything here
        if (!longTap)
        {
            longTap = true;
            Task tempo = TempLongTap(360);
            DisplayAlert("Long Pressed", myClass.name, "Ok");
        }
    }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>