Xamarin.Forms列表到对象列表的控件 [英] Xamarin.Forms list through list of objects control

查看:96
本文介绍了Xamarin.Forms列表到对象列表的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xamarin中的哪个控件可用于通过带有左右箭头的对象列表(例如屏幕快照中的一个)列出对象?

Which control in Xamarin can be utilized to do listing through a list of objects with the arrows left and right such as the one on the screenshot?

推荐答案

Xmarin.forms中没有这样的控件.但是您可以自己实现.

There is no such a control in Xmarin.forms .But you can implement it by yourself.

在xaml中

in xaml

<Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
  <Grid.RowDefinitions>

  </Grid.RowDefinitions>

 <Grid.ColumnDefinitions>
     <ColumnDefinition Width="0.15*" />
     <ColumnDefinition Width="0.7*" />
     <ColumnDefinition Width="0.15*" />           
 </Grid.ColumnDefinitions>

 <StackLayout Grid.Column="0" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
     <Image Source="xxx" x:Name="rightBtn"/>   
 </StackLayout>

 <controls:CarouselViewControl Grid.Column="1" Orientation="Horizontal" InterPageSpacing="10" Position="{Binding myPosition}" ItemsSource="{Binding myItemsSource}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
     <controls:CarouselViewControl.ItemTemplate>
        <DataTemplate>
         <local:MyView />
         <!-- where MyView is a ContentView -->
        </DataTemplate>
     </controls:CarouselViewControl.ItemTemplate>
  </controls:CarouselViewControl>

  <StackLayout Grid.Column="2" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
     <Image Source="xxx" x:Name="leftBtn"/>
  </StackLayout>

</Grid>

您可以使用 CarouselView .并单击向右向左按钮时更改其position.您可以添加

You can use CarouselView . And change the position of it when you click right or left button .You can add a tap gesture recognizer on image or use ImageButton if you want to set button image by yourself. Or you can use default arrows of CarouselView .

这篇关于Xamarin.Forms列表到对象列表的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆