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

ListView cut off - what's the dealeo?

$
0
0

Hi,

uhm I'm a newbie so no surprise - trying to make a nice ListView in XAML. My ListView is populated with more rows than can be displayed on the device. However, on Android the ListView is cut off about 2/3 rds down the screen. I have set all layouts to 'FillAndExpand' so I would think the screen height should be filled out with the ListView.

Any assistance appreciated.

Thanks!

Chris

<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="mContacts2.Xaml.EmployeeListXaml"
    Title="">
  <ContentPage.Content>
    <ScrollView
      VerticalOptions="FillAndExpand">
      <RelativeLayout
            VerticalOptions="FillAndExpand"
            HorizontalOptions="FillAndExpand">
      <StackLayout Orientation="Vertical"
             VerticalOptions="FillAndExpand"
              Padding="2">
        <!-- Search Bar -->
            <StackLayout Orientation="Horizontal" VerticalOptions="Center" Padding="3">
                <Entry x:Name="SearchEntry" Placeholder="Employee Name" Text=""/>
                <Button x:Name="SearchButton" Text="Search" Clicked="OnSearchButtonClicked"  Style="{StaticResource ButtonStyle}"/>
            </StackLayout>
      <ListView x:Name="listView"
               ItemSelected="OnItemSelected"
               IsGroupingEnabled="False"
               HasUnevenRows="True"
               VerticalOptions="FillAndExpand"
                HorizontalOptions="FillAndExpand"
                RowHeight="60">
        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
              <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*"></ColumnDefinition>
                  <ColumnDefinition Width="30"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Label Grid.Row="0" Grid.Column="0" Text="{Binding DisplayName}"  Style="{StaticResource HeaderLabelStyle}"></Label>
                <Label Grid.Row="1" Grid.Column="0" Text="{Binding Title}" Style="{StaticResource LabelStyle}"></Label>
                <Image Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" HeightRequest="24" Source="arrowright" />
              </Grid>
            </ViewCell>
          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView> 
      </StackLayout>
      <ActivityIndicator x:Name="activityIndicator"
            Color="Black"

            VerticalOptions="CenterAndExpand"
            HorizontalOptions="CenterAndExpand"
            RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent,
                    Property=Height,
                    Factor=0.28}"
            RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent,
                    Property=Height,
                    Factor=0.33}" />
    </RelativeLayout>
  </ScrollView>
</ContentPage.Content>
</ContentPage>

Viewing all articles
Browse latest Browse all 58056

Trending Articles



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