开发者

Datagrid inside Scatterview Surface2 application WPF

I have a datagrid placed inside a scatterview in WPF. I cant touch and select a row from the datagrid. In the touchdown event, its returning the value in the selected cell. But its not selecting the entire row or high开发者_Python百科lighting it.

<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>


Try the following:

  // 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();
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜