简体   繁体   English

在Windows Phone 8.1上传输GridView并不顺利

[英]Transferring GridView is not smooth on Windows Phone 8.1

I'm trying to move a GridView with the ManipulationDelta event, similar to dragging. 我正在尝试使用ManipulationDelta事件移动GridView,类似于拖动。

My ManipulationDelta event looks like this: 我的ManipulationDelta事件如下所示:

private void GridView_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
    var tt = (TranslateTransform)(sender as GridView).RenderTransform;
    tt.X += e.Delta.Translation.X;
    UpdateLayout();
}

The problem with this approach is that it's not smooth at all. 这种方法的问题在于它根本不平滑。 Is there any better way to do this? 有什么更好的方法吗?

Remove the update layout call. 删除更新布局调用。

Changing the render transform is fast since it applies purely on the render thread and doesn't have to synchronize with the code thread or do a layout pass. 更改渲染转换速度很快,因为它仅应用于渲染线程,而不必与代码线程同步或进行布局传递。 UpdateLayout force everything to re-layout which is slow and unnecessary. UpdateLayout强制所有内容重新布局,这是缓慢且不必要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM