如何将项目选择的数据绑定到 xamarin 表单中的按钮命令

How to bind item selected data to a button command in xamarin forms

我在 syncfusion 列表视图中有一个命令按钮,我在视图模型上触发了命令,但我不知道如何传递所选项目的数据。这就是我的

 <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
         }           

请参考以下链接,

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