WPF为stackpanel设置滚动条
最新遇到ItemControl控件增加滚动条功能,找半天还是在StackPanel模板外添加的。
<ScrollViewer x:Name="scrolls" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Height="300">
<ScrollViewer.Content>
<StackPanel x:Name="numberedItemsStackPanel" Orientation="Horizontal" ScrollViewer.VerticalScrollBarVisibility="Auto">
…………………………………………
</StackPanel>
</ScrollViewer.Content>
</ScrollViewer>