This is a migrated thread and some comments may be shown as answers.

Listview Item spacing issues

1 Answer 1279 Views
ListView
This is a migrated thread and some comments may be shown as answers.
lyndon
Top achievements
Rank 1
lyndon asked on 18 May 2017, 03:07 PM

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>

1 Answer, 1 is accepted

Sort by
0
lyndon
Top achievements
Rank 1
answered on 19 May 2017, 03:31 PM
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.
Tags
ListView
Asked by
lyndon
Top achievements
Rank 1
Answers by
lyndon
Top achievements
Rank 1
Share this question
or