【问题标题】:How to bind item selected data to a button command in xamarin forms如何将项目选择的数据绑定到 xamarin 表单中的按钮命令
【发布时间】:2020-06-02 21:22:43
【问题描述】:

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

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

查看模型

         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
         }           

【问题讨论】:

    标签: listview button inotifypropertychanged syncfusion 2-way-object-databinding


    【解决方案1】:
    猜你喜欢
    • 2017-04-16
    • 2019-05-11
    • 2019-08-08
    • 2017-08-17
    • 1970-01-01
    • 1970-01-01
    • 2015-06-21
    • 2017-01-15
    • 1970-01-01
    相关资源
    最近更新 更多