Listview Item spacing issues

2 posts, 0 answers
  1. lyndon
    lyndon avatar
    3 posts
    Member since:
    May 2014

    Posted 18 May Link to this post

    I'm having problems changing the spacing in my items in my Listview.  I have a cell with two rows of data.  I cant seem to minimize the spacing the between the top and bottom rows. My itemTemplate definition is pasted below.  I've added color to the backgrounds to visualize the issue.  Simply put, there is too much space between the bisque and green stacklayouts.  

    Disclaimer:  I've added more stacklayouts than I normally do with a Listview and understand that this is not great code.  I put a wrapper around the rows so I could visualize them with a background color.  

     

    <dataControls:RadListView.ItemTemplate>
                       <DataTemplate>
                          <listView:ListViewTemplateCell>
                              <listView:ListViewTemplateCell.View>
                                  <StackLayout BackgroundColor="Gray" Padding="0,0,0,0" >
                                      <StackLayout Orientation="Horizontal" BackgroundColor="Bisque" Padding="0,0,0,0" VerticalOptions="StartAndExpand">
                                          <Label  Text="{Binding Val.DisplayName}" HorizontalOptions="StartAndExpand"  Margin="20,0,0,0" />
                                          <Label  Text="{Binding Val.PhoneNumber}" HorizontalOptions="EndAndExpand"  Margin="0,0,13,0" BackgroundColor="Aqua"/>
                                      </StackLayout>
                                      <StackLayout BackgroundColor="Green" HorizontalOptions="StartAndExpand" Padding="0,0,0,0" VerticalOptions="StartAndExpand">
                                          <Label Text="{Binding Val.Title}" VerticalOptions="StartAndExpand" Margin="20,0,13,0" BackgroundColor="Red"/>
                                          </StackLayout>
                                  </StackLayout>
                                       
                              </listView:ListViewTemplateCell.View>
                          </listView:ListViewTemplateCell>
                      </DataTemplate>                     
                  </dataControls:RadListView.ItemTemplate>
  2. lyndon
    lyndon avatar
    3 posts
    Member since:
    May 2014

    Posted 19 May in reply to lyndon Link to this post

    Brainfart.  This issue could be resolved by the StackLayout spacing property.  For some reason I thought the issue was related to the spacing within the control.  Please feel free to delete this thread.
Back to Top