Inside ScrollViewer problem with ListBox ItemsPanel as WrapPanel
Posted: Sun Apr 03, 2016 4:19 am
If you set the ListBox.ItemsPanel to a WrapPanel nothing is shown if you place the entier ListBox inside a ScrollViewer. Outside the ScrollViewer it works fine.
Code: Select all
<!--<ScrollViewer>-->
<ListBox BorderThickness="2" BorderBrush="Black" Margin="3">
<ListBoxItem Content=" Item1 x"/>
<ListBoxItem Content=" Item2 x"/>
<ListBoxItem Content=" Item3 x"/>
<ListBoxItem Content=" Item4 x"/>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
<!--</ScrollViewer>-->