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

HOW TO GET INDEX OF A ROW FROM LISTVIEW FROM BUTTONS INSIDE LISTVIEW

$
0
0

ok i need to get index of listview item from buttons inside listview item, without give a tapped in listview item...sounds tricky

-------Listview item1-------

button1 button2 button3

-------Listview item2-------

button1 button2 button3

if i press button 1 in Listview item1 i wil get the index of Listview item1 wich is 0, and if i press button 1 in Listview item2 i wil get the index of Listview item2 wich is 1, and so on... im not clicking the listview item...

i have this

.xaml

 <StackLayout Grid.Column="0" Grid.Row="6">

                                    <Button Clicked="OnLikeClick" CommandParameter="{Binding .}" Text="popo"   /> 

.cs

public void OnLikeClick(object sender, EventArgs args)
{

        Button button = (Button)sender;
        StackLayout listViewItem = (StackLayout)button.Parent;



        System.Diagnostics.Debug.WriteLine("index:>" + listViewItem.index?????);




    }

thanks

im really new in xamarin


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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