【发布时间】:2014-10-05 02:36:37
【问题描述】:
在我的 WPF 应用程序中,我有一个窗口,其中包含许多动态 DataGrid,顶部带有标签作为标题行。这些元素是 ScrollViewer 的子元素。 如果我向上或向下滚动 ScrollViewer 总是跳到标签。从 DataGrids 的内容中,只有第一列是可见的。 我的 WPF 代码:
<ScrollViewer CanContentScroll="True" PanningMode="VerticalFirst" MouseWheel="ResultDataGrid_OnMouseWheel" x:Name="ResultScrollViewer" Height="Auto">
<StackPanel x:Name="ResultStackPanel">
<TextBlock Text="Result" Style="{StaticResource Heading2}" />
<StackPanel Style="{StaticResource ResultStackPanel}">
<Label Content="Informations" x:Name="LabelInfo" Style="{StaticResource BoldLabel}"/>
<DataGrid x:Name="ResultMeta" Style="{StaticResource DataGridStyle}" />
</StackPanel>
<StackPanel Style="{StaticResource ResultStackPanel}">
<Label Content="Statistics" Style="{StaticResource BoldLabel}"/>
<DataGrid x:Name="ResultStat" Style="{StaticResource DataGridStyle}" />
</StackPanel>
<StackPanel Style="{StaticResource ResultStackPanel}">
<Label Content="Resources" Style="{StaticResource BoldLabel}" />
<DataGrid x:Name="ResultResources" Style="{StaticResource DataGridStyle}" />
</StackPanel>
<!-- ... -->
</StackPanel>
</ScrollViewer>
【问题讨论】:
标签: wpf datagrid scroll scrollviewer