Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems like you were on the right track: replacing the ItemsPanelTemplate in the ListBox with a WrapPanel, setting WrapPanel's Orientation to Vertical, and setting ScrollViewer.VerticalScrollBar to Disabled should be all you need to do.</p> <p>This works for me:</p> <pre><code>&lt;Window x:Class="ScrollingWrapPanel.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"&gt; &lt;Grid&gt; &lt;ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled"&gt; &lt;ListBox.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;WrapPanel IsItemsHost="True" Orientation="Vertical"/&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ListBox.ItemsPanel&gt; &lt;ListBoxItem&gt; &lt;Rectangle Width="80" Height="80" Margin="10" Fill="Red"/&gt; &lt;/ListBoxItem&gt; &lt;ListBoxItem&gt; &lt;Rectangle Width="80" Height="80" Margin="10" Fill="Orange"/&gt; &lt;/ListBoxItem&gt; &lt;ListBoxItem&gt; &lt;Rectangle Width="80" Height="80" Margin="10" Fill="Yellow"/&gt; &lt;/ListBoxItem&gt; &lt;ListBoxItem&gt; &lt;Rectangle Width="80" Height="80" Margin="10" Fill="Green"/&gt; &lt;/ListBoxItem&gt; &lt;ListBoxItem&gt; &lt;Rectangle Width="80" Height="80" Margin="10" Fill="Blue"/&gt; &lt;/ListBoxItem&gt; &lt;ListBoxItem&gt; &lt;Rectangle Width="80" Height="80" Margin="10" Fill="Indigo"/&gt; &lt;/ListBoxItem&gt; &lt;ListBoxItem&gt; &lt;Rectangle Width="80" Height="80" Margin="10" Fill="Violet"/&gt; &lt;/ListBoxItem&gt; &lt;/ListBox&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p>That should cause it to render out a full column vertically, wrap, and then continue on the next column, scrolling as necessary horizontally (but not vertically), as in the picture:</p> <p><a href="http://i40.tinypic.com/358dzxj.png">ListBox with WrapPanel wrapping vertically http://i40.tinypic.com/358dzxj.png</a></p> <p>The key things in this implementation are</p> <ol> <li>Setting Orientation="Vertical" on the WrapPanel so that things wrap vertically and not horizontally, and</li> <li>Setting ScrollViewer.VerticalScrollBarVisibility="Disabled" on the ListBox so that the ScrollViewer knows to restrict its height to the available space.</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload