INDEX OF THE ITEM

how i can get index of the item when tap the button inside the sflistview, the button i build under sfexpander ?

i checked the document ...only swipe event include the indexof 


please advise 

 


1 Reply

SY Suthi Yuvaraj Syncfusion Team May 31, 2023 02:16 PM UTC

Hi Anson,


We would like to you can get the item index of the item on a button, you can get the selected item object in the ViewModel by the Tapped command, and from there you can get the index, Please refer to the below sample and code snippet for more reference.


Code snippet:

private void buttonTapped(object obj)

{

TappedItem = obj as Contacts;

var index = DataSource.DisplayItems.IndexOf(TappedItem);

Application.Current.MainPage.DisplayAlert("Alert", "Item Tapped "+index, "Ok");

  }


Please let us know if you have any concern

Regards,

Suthi Yuvaraj.


Attachment: ListViewXamarin_1cabc526.zip

Loader.
Up arrow icon