0
我有一個ListView
,下面是一個StackLayout
。我試圖使ListView
的高度隨着更多行的增加而增加(使用StackLayout
中的命令),只使用XAML。發生了什麼事是ListView控件是高度過大和頁面結束了滾動與StackLayout
一路下跌如何讓ListView高度動態?
這裏是我的代碼:
<StackLayout Orientation="Vertical">
<BoxView HorizontalOptions="FillAndExpand" HeightRequest="10" Color="Transparent/>
<StackLayout>
<Label Style="{StaticResource AXASOL_Label_H1}" TextColor="White" Text="Do you have Dependents?" HorizontalOptions="Center"/>
</StackLayout>
<ListView>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
</StackLayout>
</StackLayout>
我試過這個,但是隨着列表增長,最後一行不下去 –
@AlfieMcNarutoad我編輯了我的文章。按鈕點擊現在將添加一個新項目到列表視圖。我不明白你最後一排的意思是不會下降。你想添加一個新項目發生什麼? – user3292642
@AlfieMcNarutoad你可以嘗試設置包含ListView的行的高度爲「Auto」嗎?這是否解決了您的問題? – user3292642