Hi Liam,Thank you for contacting Syncfusion support.Based on the given details, we have checked the reported issue with SfListView and SfButton controls in v17.2.0.36. And the button command is triggered as expected in Android and UWP platform. We suspect that the issue may occur at sample level. So, we request you to please check with the following sample.If you are still facing the issue, we request you to please modify the above sample to replicate the issue and revert us the replication procedure which would highly help us to analyze the issue better and update you an appropriate solution.Please let us know if you require further assistance.Regards,Dinesh Babu Yadav
<sfList:SfListView
HorizontalOptions="Center"
VerticalOptions="Center"
SelectionMode="Single"
x:Name="listview"
ItemsSource="{Binding Fruits}"
SelectionBackgroundColor="Transparent"
FocusBorderColor="Black">
<sfList:SfListView.Behaviors>
<behaviors:EventToCommandBehavior
EventName="ItemTapped"
Command="{Binding ShowFruitPriceCommand}"
EventArgsParameterPath="ItemData" />
</sfList:SfListView.Behaviors>
<sfList:SfListView.ItemTemplate>
<DataTemplate>
<buttons:SfButton
HorizontalOptions="Center"
BackgroundColor="ForestGreen"
CommandParameter="{Binding}"
Command="{Binding BindingContext.ShowFruitPriceCommand, Source={x:Reference listview}}"
TextColor="WhiteSmoke"
Text="{Binding Name}"/>
</DataTemplate>
</sfList:SfListView.ItemTemplate>
<sfList:SfListView.SelectedItemTemplate>
<DataTemplate>
<buttons:SfButton
HorizontalOptions="Center"
BackgroundColor="SlateGray"
TextColor="WhiteSmoke"
Text="{Binding Name}"/>
</DataTemplate>
</sfList:SfListView.SelectedItemTemplate>
</sfList:SfListView> |
Hi Liam,In android, Button will not pass touch to its parent ListView. So, the Command associated with ItemTapped event of ListView will not work when you tap over Button. But, when you load a label, then label won’t handle touch and it will pass the touch to parent. So, its working as expected.This is expected behavior. Requesting to bind the command directly to Button as on the below code snippet. Please refer below reports,
<sfList:SfListViewHorizontalOptions="Center"VerticalOptions="Center"SelectionMode="Single"x:Name="listview"ItemsSource="{Binding Fruits}"SelectionBackgroundColor="Transparent"FocusBorderColor="Black"><sfList:SfListView.Behaviors><behaviors:EventToCommandBehaviorEventName="ItemTapped"Command="{Binding ShowFruitPriceCommand}"EventArgsParameterPath="ItemData" /></sfList:SfListView.Behaviors><sfList:SfListView.ItemTemplate><DataTemplate><buttons:SfButtonHorizontalOptions="Center"BackgroundColor="ForestGreen"CommandParameter="{Binding}"Command="{Binding BindingContext.ShowFruitPriceCommand, Source={x:Reference listview}}"TextColor="WhiteSmoke"Text="{Binding Name}"/></DataTemplate></sfList:SfListView.ItemTemplate><sfList:SfListView.SelectedItemTemplate><DataTemplate><buttons:SfButtonHorizontalOptions="Center"BackgroundColor="SlateGray"TextColor="WhiteSmoke"Text="{Binding Name}"/></DataTemplate></sfList:SfListView.SelectedItemTemplate></sfList:SfListView>Thanks,Sivakumar