locked
How to remove the gap/space between listview items ? RRS feed

  • Question

  • I tried to use

    <ListView.ItemContainerStyle>
      <Style TargetType="ListViewItem"  >
         <Setter Property="BorderThickness" Value="0"/>
         <Setter Property="Padding" Value="0,0,0,0"/>
      </Style>
    </ListView.ItemContainerStyle>

    But it did not help .

    is there anything else that I can do to remove the space ,except margin with negative value?

    Wednesday, October 17, 2012 3:36 PM

Answers

  • I had a similar problem with gridView Items and the solution was get the default ItemTemplate

    and see the code for remove all thinks that make the space that i didn´t like.

    I know this should be more easy, i tried the same solution you are trying....but not works :/

    Even you set that values for the itemtemplate...

    Here is my topic:

    Removing space between gridview items

    Spacing between GridViewItems



    Sara Silva



    • Edited by saramgsilva Wednesday, October 17, 2012 4:27 PM
    • Marked as answer by shaharPO Thursday, October 18, 2012 9:30 PM
    Wednesday, October 17, 2012 4:25 PM

All replies

  • I had a similar problem with gridView Items and the solution was get the default ItemTemplate

    and see the code for remove all thinks that make the space that i didn´t like.

    I know this should be more easy, i tried the same solution you are trying....but not works :/

    Even you set that values for the itemtemplate...

    Here is my topic:

    Removing space between gridview items

    Spacing between GridViewItems



    Sara Silva



    • Edited by saramgsilva Wednesday, October 17, 2012 4:27 PM
    • Marked as answer by shaharPO Thursday, October 18, 2012 9:30 PM
    Wednesday, October 17, 2012 4:25 PM
  • How did you get the default itemtemplate for listview ?

    Thursday, October 18, 2012 8:01 PM
  • Select the project with the mouse and open the contextMenu, there is option for open it in Blend.

    Inside of Blend select the gridview and open the context menu:


    Sara Silva

    Thursday, October 18, 2012 9:07 PM
  • Thanks I already found it it's inside listviewitem ->outercontainer->reorderHintContent->contentcontainer->innerDragContent margin

    they give it a default margin and it's like you said I need to rewrite the defaulttemplate and change it

    Thursday, October 18, 2012 9:30 PM
  • Blend is a good hint, here's what I did.  I opened Blend, created a new windows phone 8.1 project, added a ListView then right clicked on the following to edit the ListViewItemTemplate. Then specifically there is code in there to add a selection "checkbox" which has a minimum height of 34 pixels.  If you remove the "SelectedBorder" and the "CheckboxTiltContainer" then the items are nice and tight.
    • Proposed as answer by kburgoyne Sunday, May 31, 2015 2:28 AM
    Monday, March 9, 2015 5:42 AM