【发布时间】:2009-10-21 10:19:55
【问题描述】:
请有人帮帮我。
我在 ListBox ItemsPanelTemplate 中设置了 WrapPanel。另外,我已经设置了ScrollViewer.CanContentScroll="True"。
但是为什么列表框项目没有逐项向上/向下滚动?滚动样式仍然是 PIXEL。
谁能帮帮我?
<Grid>
<ListBox x:Name="testListbox" ScrollViewer.CanContentScroll="True">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Width="200" ScrollViewer.CanContentScroll="True"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
<ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True">
<Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/>
</ListBoxItem>
</ListBox>
</Grid>
【问题讨论】: