I have a command button inside a syncfusion list view , I fired the command on the view model , but I dont know how to pass the data of the item selected . This is what I have
<syncfusion:SfListView x:Name="listView"
SelectionBackgroundColor="Transparent"
ItemsSource="{Binding AvailableData}" ItemSpacing="10" >
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Label text="{Binding id requests}"/>
<Button Text="Cancel" Command="{Binding Source={x:Reference RequestsPage}, Path=BindingContext.CancelCommand}" ></Button>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
View Model
public ICommand CancelCommand
{
get;
set;
}
CancelCommand = new Command(CancelBooking);
void CancelBooking()
{
I need to capture the item source this button is inside each item that is
displayed in the list , I need to capture the data from this selection
}
Please refer below links,
binding-command-of-button-inside-the-itemtemplate-of-xamarinforms-listview-to-viewmodel-command
how-to-delete-an-item-when-tapping-delete-button-in-listview-itemtemplate-in-mvvm