https://forums.xamarin.com/Discussion/58487/listview-long-press-tap-delete-popup https://forums.xamarin.com/Discussion/18798/detect-long-tap-on-listview-item https://forums.xamarin.com/discussion/27323/how-can-i-recognize-long-press-gesture-in-xamarin形式 希望这会有所帮助.I want to change the Image by changing the IconToShow propery with binding (programmatically), when the item is pressing.How can I trigger an OnPressed event ??<ListView x:Name="listView" ItemSelected="OnItemSelected" ItemsSource="{Binding MainMenuList}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" IsVisible="{Binding MenuStyle, Converter={StaticResource not}" SeparatorColor="Blue"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <Grid> <Grid.RowDefinitions> <RowDefinition Height="50" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="10" /> <ColumnDefinition Width="30" /> <ColumnDefinition Width="10" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Image Source="{Binding IconToShow}" Grid.Row="0" Grid.Column="1"/> <Label Text="{Binding Title}" Grid.Row="0" Grid.Column="3"/> </Grid> </ViewCell.View> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> 解决方案 So for LongPress events inside a cell you will need a custom renderer of a cell to do what you need, here are some links that may help you:https://forums.xamarin.com/discussion/58487/listview-long-press-tap-delete-popuphttps://forums.xamarin.com/discussion/18798/detect-long-tap-on-listview-itemhttps://forums.xamarin.com/discussion/27323/how-can-i-recognize-long-press-gesture-in-xamarin-formsHope this helps. 这篇关于Xamarin Forms ListView发生事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-17 22:43
查看更多