0
我正在尋找一個跨ListView的平臺刷卡來執行操作,如打開菜單或刪除項目。跨平臺列表查看刷入xamarin表格
有沒有人實現過這樣的場景?我想例如在向左滑動項目時刪除項目。
我需要支持所有平臺:IOS/DROID/WIN
我正在尋找一個跨ListView的平臺刷卡來執行操作,如打開菜單或刪除項目。跨平臺列表查看刷入xamarin表格
有沒有人實現過這樣的場景?我想例如在向左滑動項目時刪除項目。
我需要支持所有平臺:IOS/DROID/WIN
最簡單的方法是使用內置的語境下操作,這可以讓你顯示的菜單項時,您的列表項是在iOS或刷卡長按Android上
<ListView x:Name="ContextDemoList">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.ContextActions>
<MenuItem Clicked="OnMore" CommandParameter="{Binding .}"
Text="More" />
<MenuItem Clicked="OnDelete" CommandParameter="{Binding .}"
Text="Delete" IsDestructive="True" />
</ViewCell.ContextActions>
<StackLayout Padding="15,0">
<Label Text="{Binding title}" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
如果刷卡是兩個平臺的要求,或者你需要做項目時刷卡(而不是顯示的菜單項)的行動,那麼我建議你SyncFucion的listview控件,它是avai與社區許可證拉布勒,它提供了更多的靈活性
<syncfusion:SfListView x:Name="listView" AllowSwiping="True">
<syncfusion:SfListView.LeftSwipeTemplate>
<DataTemplate x:Name="LeftSwipeTemplate">
<Grid>
<Grid BackgroundColor="#009EDA" HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Column="0">
<Grid VerticalOptions="Center" HorizontalOptions="Center">
<Image Grid.Column="0"
Grid.Row="0"
BackgroundColor="Transparent"
HeightRequest="35"
WidthRequest="35"
Source="Favorites.png" />
</Grid>
</Grid>
</Grid>
</DataTemplate>
</syncfusion:SfListView.LeftSwipeTemplate>
</syncfusion:SfListView>
謝謝您的建議。我試圖找到比購買控制許可更開源的東西。試圖在兩個平臺上保持滑動 –