C# 在XAML中形成ListView自动高度

C# 在XAML中形成ListView自动高度,c#,xaml,listview,xamarin.forms,C#,Xaml,Listview,Xamarin.forms,我有一个带有ViewCell的ListView,它的ViewCell包含带有巨大文本的标签。如何制作自动高度ViewCell 问题截图 我的XAML代码: <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Physis.Movements_And_Interactions_Page"

我有一个带有ViewCell的ListView,它的ViewCell包含带有巨大文本的标签。如何制作自动高度ViewCell

问题截图

我的XAML代码:

    <ContentPage  xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Physis.Movements_And_Interactions_Page" xmlns:local="clr-namespace:Physis">
    <ContentPage.ToolbarItems> 
    <ToolbarItem  x:Name="settings" Text="{Binding settings_text}" Clicked="Handle_Clicked"/>
    </ContentPage.ToolbarItems>
    <ContentPage.Content>


     <StackLayout Margin="20,35,20,20" x:Name="Main_View2" >
            <ListView x:Name="Main_Menu" ItemsSource="{Binding Planets}" ItemSelected="Handle_ItemSelected" ItemTapped="Handle_ItemTapped" BackgroundColor="{DynamicResource Key=backgroundColor}" SeparatorColor="{DynamicResource Key=textColor}">
            <ListView.ItemTemplate>
            <DataTemplate >
             <ViewCell >

              <StackLayout Orientation="Vertical" >
               <Label Text="{Binding Name}" StyleClass="Body"/>
               <Label Text="{Binding Description}" StyleClass="Body"/>               
             </StackLayout>

             </ViewCell>
            </DataTemplate>
             </ListView.ItemTemplate>
              </ListView>

      </StackLayout >
</ContentPage.Content>

谢谢大家

在ListView上设置
hasRows=“true”
。请参阅此处的文档