2016-05-10 40 views
4

我正在嘗試製作基於卡片的listView在基於ahaliav fox的xaml示例的Xamarin Forms中here然而,我沒有得到任何接近他所得到的東西我只有一個文本標籤我需要在卡中顯示如何在Xamarin Forms中製作卡片樣式ListView

繼承人我的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或更小,以任何方式來解決這個錯誤?

我已經更新了我的代碼,以反映我遇到

任何幫助將是驚人的新問題!

+0

你的問題是什麼?你其實並沒有問過,而且你也沒有清楚地說明你有什麼問題。 – Jason

+0

我更新了我的問題,類似於我的問題,請查看:) – Phoneswapshop

+0

「Label」中的名稱有多長?您的測試設備還有多大?嘗試刪除一些「Padding」以查看是否有幫助?或者嘗試將'Label.LineBreakMode'設置爲'WordWrap' – hvaughan3

回答

6

試試將ListView.HasUnevenRows屬性設置爲true

+0

非常感謝你! :) – Phoneswapshop

相關問題