如何在Xamarin表单中制作卡片样式ListView [英] How to make a Card Style ListView In Xamarin Forms

查看:168
本文介绍了如何在Xamarin表单中制作卡片样式ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图基于ahaliav fox的xaml示例在Xamarin Forms中创建基于卡的listView

我通过使用框架使ListView项目类似于卡片,但是标签上的文本会截断一半,除非我将文本大小设置为9或更小,否则将无法解决此错误.

我已更新代码以反映我遇到的新问题

任何帮助都将是惊人的!

解决方案

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

I am trying to make a card based listView In Xamarin Forms based off of ahaliav fox's xaml example here however I am not getting anywhere near what he got I only have one text label that I need to display in the card

heres my xaml code:

    <?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>

EDIT: I got the ListView item to resemble a card by using a Frame however The text on the label cuts off half way unless I make the text size 9 or lower that's way to small any way to fix this bug?

I have updated my code to reflect the new issue i'm having

any help would be amazing!

解决方案

Try setting the ListView.HasUnevenRows property to true

这篇关于如何在Xamarin表单中制作卡片样式ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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