ได้โปรดมีคนช่วยฉันด้วย
ฉันตั้งค่า WrapPanel ใน ListBox ItemsPanelTemplate นอกจากนี้ ฉันได้ตั้งค่า 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>