Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try setting the <code>VerticalScrollBarVisibility="Disabled"</code> and <code>HorizontalScrollBarVisibility="Auto"</code> on the items control. This will disable the vertical scrolling. Also, alter the template of the items control to include a nice scroll viewer to enable scrolling.</p> <pre><code>&lt;Expander BorderBrush="Black" Header="TEST" IsExpanded="{Binding ElementName=GroupControl, Path=IsExpanded}"&gt; &lt;ItemsControl ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Auto" ItemsSource="{Binding Checks}" ItemTemplate="{StaticResource CheckTemplate}"&gt; &lt;ItemsControl.Template&gt; &lt;ControlTemplate&gt; &lt;ScrollViewer x:Name="ScrollViewer" Padding="{TemplateBinding Padding}"&gt; &lt;ItemsPresenter /&gt; &lt;/ScrollViewer&gt; &lt;/ControlTemplate&gt; &lt;/ItemsControl.Template&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;WrapPanel Orientation="Vertical" IsItemsHost="True" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;/ItemsControl&gt; &lt;/Expander&gt; </code></pre> <p><strong>UPDATE</strong></p> <p>Your code is still going with one column of items - that is normal in your case. The XAML code I posted will only work if you constraint you top-level items' height (e.g. using <code>Height</code> or <code>MaxHeight</code>). My XAML code assumes that you have a limited amount of space for the expander and you are showing that expander within an ItemsControl which gives its items <strong>as much space as they want</strong>. For example, alter your data template to look as follows:</p> <pre><code>&lt;Window.Resources&gt; &lt;DataTemplate x:Key="CheckGroupsTemplate"&gt; &lt;controls:CheckGroupControl MaxHeight="100"/&gt; &lt;/DataTemplate&gt; &lt;/Window.Resources&gt; </code></pre> <p>Now your expanders will have a maximum height and when it is reached they will start wrapping. Without that <code>MaxHeight</code> the expander will be given the opportunity to take as much space as it wants and the WrapPanel inside it will, obviously, just lay out all the items in one vertical line since there is no constraint.</p>
 

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