我在WPF的散点图中放置了一个数据网格。我无法触摸并从数据网格中选择一行。在触地事件中,它返回所选单元格中的值。但它没有选择整行或突出显示它。
<Grid Background="{StaticResource WindowBackground}" >
<s:ScatterView>
<s:ScatterViewItem Width="500" Height="300" CanRotate="False" Orientation="0" >
<DataGrid AutoGenerateColumns="True" TouchDown="DgTest_TouchDown" Name="DgTest" />
</s:ScatterViewItem>
</s:ScatterView>
答案 0 :(得分:1)
尝试以下方法:
// Declare event handlers for the Grid
DgTest.PreviewTouchDown += new EventHandler<TouchEventArgs>(On_DgTest_PreviewTouchDown);
DgTest.PreviewTouchUp += new EventHandler<TouchEventArgs>(On_DgTest_PreviewTouchUp );
void On_DgTest_PreviewTouchDown(object sender, System.Windows.Input.TouchEventArgs e)
{
//You need to capture the touch before the ScatterViewItem handles its own touch which will
//block you from receiving the touch up event
DgTest.CaptureTouch(e.TouchDevice);
e.Handled = true;
}
void On_DgTest_PreviewTouchUp (object sender, System.Windows.Input.TouchEventArgs e)
{
DgTest.ReleaseAllTouches();
}