C# 如何更改ListView中项目的高度?
我的列表视图的视觉显示有问题。我的项目的高度太小。首先我认为我的列表是空的。但是当我点击项目时,操作有效,所选项目的信息被传输。然后我只写了3个标签,列表仅显示2个标签,然后我了解到我的项目的高度太小/我试图更改列表的高度,ViewCell.View,labels,但无效。请帮助我C# 如何更改ListView中项目的高度?,c#,xaml,xamarin,xamarin.forms,xamarin.android,C#,Xaml,Xamarin,Xamarin.forms,Xamarin.android,我的列表视图的视觉显示有问题。我的项目的高度太小。首先我认为我的列表是空的。但是当我点击项目时,操作有效,所选项目的信息被传输。然后我只写了3个标签,列表仅显示2个标签,然后我了解到我的项目的高度太小/我试图更改列表的高度,ViewCell.View,labels,但无效。请帮助我 <ContentView.Content> <controls:CustomFrame CornerRadius="25,25,0,0" Margin="
<ContentView.Content>
<controls:CustomFrame CornerRadius="25,25,0,0" Margin="0" Padding="10" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<StackLayout Padding="0">
<!-- <StackLayout.GestureRecognizers>
<SwipeGestureRecognizer Direction="Up" Command="{Binding RefreshCommand}" ></SwipeGestureRecognizer>
</StackLayout.GestureRecognizers>-->
<ListView ItemsSource="{Binding MyPins}" x:Name="ListPlaces" IsPullToRefreshEnabled="True" RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing}"
SelectionMode="None">
<ListView.ItemTemplate >
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Frame CornerRadius="10" BackgroundColor="LightBlue">
<StackLayout Orientation="Vertical" Padding="0">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer CommandParameter="{Binding .}" Command="{Binding BindingContext.CallPlace, Source={x:Reference ListPlaces}}" ></TapGestureRecognizer>
</StackLayout.GestureRecognizers>
<Label x:Name="NameOfPlace" Text="{Binding MyPins.Name}" TextColor="#2D78FD" FontSize="14" FontFamily="Robobo"/>
<Label x:Name="AdressOfPlace" Text="{Binding MyPins.Address}" TextColor="#616161" FontSize="12" FontFamily="Robobo"/>
<StackLayout Orientation="Horizontal">
<Label x:Name="TimeWork" VerticalOptions="Center" Text="Open until - " TextColor="#616161" FontSize="12" FontFamily="Robobo"/>
<Label x:Name="TimeWork1" VerticalOptions="Center" Text="{Binding Opened}" TextColor="#616161" FontSize="12" FontFamily="Robobo"/>
<Image Source="openIcon" VerticalOptions="Center" />
<Button HeightRequest="24" VerticalOptions="Center" Padding="0,-3,0,0" WidthRequest="92" HorizontalOptions="EndAndExpand" FontSize="14" CornerRadius="45" BackgroundColor="#2D78FD" TextColor="White" Text="Call up"/>
</StackLayout>
</StackLayout>
</Frame>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</controls:CustomFrame>
</ContentView.Content>
在列表视图中有一个属性:
C#:
Xaml:
或者,查看列表视图上的
RowHeightDemoListView.RowHeight = 100;
<ListView x:Name="RowHeightDemoListView" RowHeight="100" />