在Windows手机中拖动并重新排序列表框项 [英] Dragging and reordering listbox items in Windows phone

查看:151
本文介绍了在Windows手机中拖动并重新排序列表框项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一个拖放列表框,但我猜没有这样的默认控制。有一点搜索给了我, Jason的博客,他已经非常优雅地拉出来了。在他写的代码中,有一个拖放处理程序存在于每个listboxitem的右端。您按下处理程序并向上或向下移动项目。我试图在项目的长按下实现相同。

I have been looking for a drag and drop listbox, but I guess there is no such default control. A bit of searching has given me,Jason's Blog in which he has pulled it off very gracefully.. In the code he has written, there is a the drag and drop handler which is present at the right end of every listboxitem.. You press on the handler and move the item up or down. I am trying to implement the same on the long press of the item..

他使用一个拖动拦截器,它基本上是一个画布,它位于列表框顶部以捕获listboxitem操纵事件。如果我想对列表框项目的保持事件进行相同的操作,那么我如何触发呢?

He uses a drag interceptor which is basically a canvas and it sits on top of listbox to capture the listboxitem manipulation events. If I want the same manipulation on the hold event of the listbox item, how do I trigger it??

这是我将事件链接到拖动拦截器的方式。
我如何在列表框项目中调用操作开始?还是还有其他一些方法呢?

This is how I have linked the events to the drag interceptor. How do i call the Manipulation Started on the hold of the listbox item?? Or is there some other way to do this?

this.dragInterceptor.ManipulationStarted += this.dragInterceptor_ManipulationStarted;
this.dragInterceptor.ManipulationDelta += this.dragInterceptor_ManipulationDelta;
this.dragInterceptor.ManipulationCompleted += this.dragInterceptor_ManipulationCompleted;
this.dragInterceptor.Hold += dragInterceptor_Hold;


推荐答案

我通过发送触发了重新排序列表框的操纵事件来自mainpage.xaml的arguments(object sender和ManipulationStartedEventArgs)。

I triggered the manipulation events of the reorder listbox by sending the arguments (object sender and ManipulationStartedEventArgs) from the mainpage.xaml.

这篇关于在Windows手机中拖动并重新排序列表框项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆