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

Strange left padding in xamarin forms list view in IOS

$
0
0

I am having troubles getting ListView aligned properly in iOS, Androind is fine

There are 2 issues:

First one, on iOS I am getting a left padding/margin on list view inside a stack panel which I don't know where it is coming from
`

    <ScrollView Grid.Row="1" HorizontalOptions="FillAndExpand">
        <Grid lb:GridLayout.RowHeights="Auto,Auto,*" HorizontalOptions="FillAndExpand">
            <Grid Grid.Row="0" lb:GridLayout.ColumnWidths="*,*,*" HeightRequest="80" VerticalOptions="Start">
                <Image Grid.Column="1" Source="login_details_add.png" Aspect="AspectFit" Margin="0,0,0,0" />
            </Grid>

            <Grid Grid.Row="1" lb:GridLayout.ColumnWidths="*,7*,*" VerticalOptions="Start">
                <shared:PageTitle Grid.Column="1" Padding="20" HorizontalOptions="CenterAndExpand"
                                        TitleText="Address Details"
                                        DescriptionText="To give you the best possible search suggestions we need to know your address." />
            </Grid>

            <StackLayout Grid.Row="2" Padding="20">
                <Grid RowSpacing="2" lb:GridLayout.RowHeights="Auto,10,*">
                    <entries:FloatingLabelTextBox Grid.Row="0" Placeholder="Your street address (unit optional)" Text="{Binding SearchText}" Grid.Column="0" x:Name="SearchText" Keyboard="Text" />

                    <StackLayout Grid.Row="2" IsVisible="{Binding HasResults}">
                        <ListView x:Name="SearchResults" ItemsSource="{Binding Addresses}" SelectedItem="{Binding SelectedAddress}">
                            <ListView.ItemTemplate>
                              <DataTemplate>
                                <TextCell Text="{Binding StreetAddress}" Detail="{Binding StateSuburbPostcode}" />
                              </DataTemplate>
                            </ListView.ItemTemplate>
                            <ListView.Footer>
                                <StackLayout HorizontalOptions="FillAndExpand">
                                </StackLayout>
                            </ListView.Footer>
                        </ListView>
                    </StackLayout>
                </Grid>

                <StackLayout Margin="20">
                    <buttons:ActionButton Grid.Column="1" Text="Enter Manually" Command="{Binding ManualEntry}" />
                </StackLayout>

            </StackLayout>
        </Grid>
    </ScrollView>
</Grid>`

I tried different things to no avail.

Second, I am getting 10 search results, but list view keeps putting empty rows below which I fixed by putting empty footer in. This fixed empty rows being rendered, but there is still big empty space below listview. How do I remove it? For now I have a code in my view code behind file, that calculates number of search results, multiplies it by row height and sets list view height, but this feels dirty.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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