Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a Card Style ListView In Xamarin Forms

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!

like image 555
Phoneswapshop Avatar asked May 10 '16 16:05

Phoneswapshop


1 Answers

Try setting the ListView.HasUnevenRows property to true

like image 111
Dean Chalk Avatar answered Sep 19 '22 02:09

Dean Chalk