对于 WPF 的 WrapPanel 中的 LiveCharts,它不能垂直滚动,
It's not scrollable vertically in case of LiveCharts in WrapPanel of WPF,
我用ListBox中的LiveChart
实现了几个图表的展示。
它运作良好。它通过自动换行第 space 页上的图表来显示。但是,它不能垂直滚动。
当我将 ScrollViewer.HorizontalScrollBarVisibility
设置为 Enabled
为带有水平滚动条的 1 行时,它可以水平滚动。
但是,使用 wrapPanel
并不是我想要的结果。
你有过这样的经历吗?请帮助我。
<StackPanel Orientation="Vertical">
<ListBox ItemSource="{Binding info}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Width="350" Height="250">
<lvc:CartesianChart>
<lvc:LineSeries Values="{Binding data}"/>
</lvc:CartesianChart>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
你没有得到垂直滚动条的原因是你把 ListBox
放在了 StackPanel
中。如果 Orientation
属性 设置为 Vertical
,则 StackPanel
测量其具有无限垂直 space 的子项:
我用ListBox中的LiveChart
实现了几个图表的展示。
它运作良好。它通过自动换行第 space 页上的图表来显示。但是,它不能垂直滚动。
当我将 ScrollViewer.HorizontalScrollBarVisibility
设置为 Enabled
为带有水平滚动条的 1 行时,它可以水平滚动。
但是,使用 wrapPanel
并不是我想要的结果。
你有过这样的经历吗?请帮助我。
<StackPanel Orientation="Vertical">
<ListBox ItemSource="{Binding info}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Width="350" Height="250">
<lvc:CartesianChart>
<lvc:LineSeries Values="{Binding data}"/>
</lvc:CartesianChart>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
你没有得到垂直滚动条的原因是你把 ListBox
放在了 StackPanel
中。如果 Orientation
属性 设置为 Vertical
,则 StackPanel
测量其具有无限垂直 space 的子项: