Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Can't get ListView to vertically center within StackLayout

$
0
0

I'm expecting the following listview to be centered vertically:
<StackLayout Orientation="Vertical"> <ListView ItemsSource="{Binding Children}" VerticalOptions="Center"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Button Text="{Binding Name}" VerticalOptions="Center"/> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout>

But instead it is at the top of the page.

However, if I use the Visual Studio live tree editor to set the ListView VerticalAlignment to Center, I get what I want. What do I need to change in the xaml to get the same behavior?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>