如何在Xamarin表单中制作卡片样式ListView

时间:2016-05-10 16:28:18

标签: c# xaml listview xamarin

我正在尝试基于ahaliav fox的xaml示例here创建一个基于卡片的listView Xamarin Forms但是我没有得到他所得到的任何地方我只有一个我需要的文本标签显示在卡片中

继承我的xaml代码:

    <?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="WebSearch.CountySelect" BackgroundColor="Gray">
  <ListView x:Name="listView">
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>

          <Frame Padding="0,0,0,3">
            <Frame.Content>
              <Frame Padding="15,15,15,15"   OutlineColor="Gray" BackgroundColor="White">
                <Frame.Content>
                  <StackLayout Padding="20,0,0,0"  Orientation="Horizontal" HorizontalOptions="CenterAndExpand">
                    <Label Text="{Binding Name}"
                           FontFamily="OpenSans-Light"
                           FontSize="9"
                           TextColor="#69add1"/>
                  </StackLayout>

                </Frame.Content>

              </Frame>
            </Frame.Content>

          </Frame>

        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
    </ListView>
</ContentPage>
编辑:我使用框架将ListView项目设置为类似于卡片然而标签上的文字会中途停止,除非我将文字大小设置为9或更低,以便以任何方式解决此问题错误?

我已更新我的代码以反映我有

的新问题

任何帮助都会很棒!

1 个答案:

答案 0 :(得分:7)

尝试将ListView.HasUnevenRows属性设置为true