Reputation: 87
I have a ListView that I need stacked under another horizontal Stack Layout. No matter what I do, it appears that the ListView overlaps everything above it. I need it to not have this behavior and actually show the layout above. I just do not know how, and any help would be appreciated.
I've also attempted to put both in a grid, and did manage to free up space on the top but none of the Test labels show up, still.
As seen above, the ListView simply overlaps that which is above it (the stack layout with labels), as well as is shown with two entries above Aaron offscreen up top.
<?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="engME.YourFullNamesListPage">
<StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="Test 1" HorizontalTextAlignment="Center"/>
<Label Text="Test 2" HorizontalTextAlignment="Center"/>
<Label Text="Test 3" HorizontalTextAlignment="Center"/>
<Label Text="Test 4" HorizontalTextAlignment="Center"/>
</StackLayout>
<StackLayout Orientation="Vertical" VerticalOptions="Fill" HorizontalOptions="FillAndExpand">
<ListView x:Name="FullNamesList" VerticalOptions="FillAndExpand" RowHeight="50">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.1*"/>
<ColumnDefinition Width=".3*"/>
</Grid.ColumnDefinitions>
<Label FontSize="Large"
FontAttributes="Bold"
HorizontalTextAlignment="Start"
Margin="20,0,0,0"
VerticalTextAlignment="Center"
Grid.Row="0"
Grid.Column="0">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding Gender}" Value="F">
<Setter Property="Text" Value="{Binding Name}"/>
<Setter Property="TextColor" Value="#cc0066"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding Gender}" Value="M">
<Setter Property="Text" Value="{Binding Name}"/>
<Setter Property="TextColor" Value="#007acc"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding Gender}" Value="A">
<Setter Property="Text" Value="{Binding Name}"/>
<Setter Property="TextColor" Value="#00994d"/>
</DataTrigger>
</Label.Triggers>
</Label>
<Label Text="{Binding ShortMeaning}"
FontSize="Small"
TextColor="Gray"
VerticalTextAlignment="Center"
Grid.Row="0"
Grid.Column="1">
</Label>
<Image Source="favorite.png"
Grid.Row="0"
Grid.Column="2"
Scale=".7">
</Image>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ContentPage>
Upvotes: 0
Views: 1496
Reputation: 666
That StackLayout, that has a ListView inside it, you don't need it. Delete it and see what will happen.
Upvotes: 1