Xamarin.Forms>列表>自定义渲染器

时间:2016-04-28 02:55:55

标签: listview xamarin xamarin.forms renderer

是否可以为Xamarin.Forms列表编写一个自定义渲染器,它将两行相互渲染,所以基本上就像一个绑定的网格视图

-------------
Item1 | Item2
-----------
Item3 | Item4
-------------
Item5 ...

谢谢,尼古拉

1 个答案:

答案 0 :(得分:0)

您不需要在Xamarin.Forms中使用自定义渲染器。您可以在Xamarin Forms XLabs中使用GridView组件。将MaxColumns设置为2将连续呈现2列

<ctrl:GridView 
 HorizontalOptions="FillAndExpand"
  VerticalOptions="FillAndExpand"
  x:Name="GrdView" RowSpacing="5"
  ColumnSpacing="5" MaxColumns="2"
  TileHeight="120"
   CommandParameter="{Binding}"
   Command="{Binding StartTaskCommand}"
   IsClippedToBounds="False">
  </ctrl:GridView>

Here is a tutorial on how to use that