WPF Wrap Panel that outlines 4 columns at a time

117 views Asked by At

I have a list view with a wrap panel as its itemsPanelTemplate. The items in the wrap panel are going to be displayed in pages in groups of 28. I would like to draw a box around every 28 items, or every 4 columns so that you "preview" the page layout more easily.
enter image description here

If not a box, vertical lines after every 4th column would do. Thank you for taking the time to read my question.

1

There are 1 answers

0
Andrew KeepCoding On

In order to add a border for each list view item (28 items each), you can define the ItemContainerStyle like this.

<ListView>
    <ListView.ItemContainerStyle>
        <Style TargetType="ListViewItem">
            <Setter Property="BorderBrush" Value="DarkGray"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Margin" Value="3"/>
        </Style>
    </ListView.ItemContainerStyle>



</ListView>