我在我的应用程序上取得了一些不错的进展,但遇到了一个让我难过的问题。我希望有人能提供他们的专业知识吗?
我的应用程序旨在成为“记分表”......其中一个 PivotItems 具有 ScrollViewer(水平滚动,垂直禁用),内部有一个水平方向的 StackPanel。这个 StackPanel 包含一个“ScoreSheet”用户控件,它基本上是一个带有各种文本框的网格。所以......有点像这样(除了 ScoreSheet 项目以编程方式添加到 StackPanel):
<controls:PivotItem>
<controls:PivotItem.Header>
<TextBlock Text="score sheet" FontSize="45" Height="80" />
</controls:PivotItem.Header>
<ScrollViewer Width="470" Height="560" VerticalAlignment="Top" x:Name="sv_scoresheets" MaxHeight="560" MinHeight="560" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" IsHitTestVisible="False">
<StackPanel Name="sp_scoresheets" Orientation="Horizontal">
<local:ScoreSheet></local:ScoreSheet>
<local:ScoreSheet></local:ScoreSheet>
<local:ScoreSheet></local:ScoreSheet>
</StackPanel>
</ScrollViewer>
</controls:PivotItem>
概念是“上一个”和“下一个”按钮位于页面底部的 ApplicationBar 中,它们会触发 ScrollViewer 向左或向右的动画(即当前轮次 * ScoreSheet 的宽度)。通过在 ScrollViewer 上将“IsHitTestVisible”设置为“False”,用户无法手动将显示的 ScoreSheet 移动到一个奇怪的位置,并且在 PivotItems 之间向左/向右滑动仍然可以按预期工作。
这一切都很好。:)
但是...问题出在 ScoreSheet 控件上,我想要一些按钮和文本框,以便用户可以在网格中输入分数。通过在 ScrollViewer 上设置“IsHitTestVisible”,点击/等。只是被忽略。
I tried setting "IsHitTestVisible" to "True" and instead running a function on the ScrollViewer's ManipulationStarted event (calling "e.Complete()")... but although that lets me access controls inside the ScoreSheet, I can't swipe left/right between PivotItems anymore.
So… can anyone help? I was thinking maybe I could refine the ManipulationStarted behavior somehow, maybe "passing along" the action to the Pivot control instead of having the ScrollViewer move? Or some other way I can make the ScrollViewer "inactive" but allow the controls within to be interactive?
I'd really appreciate any help. Thanks for your time!