ListViewBase中的CanReorderItems属性
2013-02-19 17:49
183 查看
最近使用GridView时,想实现Item之间的自由拖动排列,一开始自己写了个Panel,后来才发现自带的API中已经有了这么一个属性CanReorderItems,然而在设置为true之后,不没有能使Item自由排列,google了一下才找到原因。
下面是来自http://www.itq.nl/blogs/post/CanReorderItems3dtrue.aspx中的解释
But, there are some things you need to know to get it to work. First of all the AllowDrop property also needs to be set to true.
And the grid or list needs to be binded to a ObservableVector (no ObservableCollection is not good enough). But in the developer preview only an interface exists for this collection, so you have to make your own implementation or borrow one.. like this one.
One caveat remains.. the ObservableVector needs to be initialized with object as T, strong types will not work in the developer preview of windows 8. Like so:
简单易懂,就不翻译了=。=
但使用过程中有以下注意点(http://msdn.microsoft.com/zh-cn/library/windows/apps/windows.ui.xaml.controls.listviewbase.canreorderitems.aspx)
如果启用了项目选择,并且将 IsSwipeEnabled 设置为 false,则用户可以通过鼠标右击来取消选择项目,但是不能通过重击手势,使用触控来取消选择项目。
如果将 CanDragItems 设置为 true,并将 IsSwipeEnabled 设置为 false,则用户可以用鼠标拖动项目,但不能通过触摸方式。
如果将 CanReorderItems 设置为 true,并将 IsSwipeEnabled 设置为 false,则用户可以用鼠标对项目重新排序,但不能通过触摸方式。
下面是来自http://www.itq.nl/blogs/post/CanReorderItems3dtrue.aspx中的解释
But, there are some things you need to know to get it to work. First of all the AllowDrop property also needs to be set to true.
And the grid or list needs to be binded to a ObservableVector (no ObservableCollection is not good enough). But in the developer preview only an interface exists for this collection, so you have to make your own implementation or borrow one.. like this one.
One caveat remains.. the ObservableVector needs to be initialized with object as T, strong types will not work in the developer preview of windows 8. Like so:
简单易懂,就不翻译了=。=
但使用过程中有以下注意点(http://msdn.microsoft.com/zh-cn/library/windows/apps/windows.ui.xaml.controls.listviewbase.canreorderitems.aspx)
如果启用了项目选择,并且将 IsSwipeEnabled 设置为 false,则用户可以通过鼠标右击来取消选择项目,但是不能通过重击手势,使用触控来取消选择项目。
如果将 CanDragItems 设置为 true,并将 IsSwipeEnabled 设置为 false,则用户可以用鼠标拖动项目,但不能通过触摸方式。
如果将 CanReorderItems 设置为 true,并将 IsSwipeEnabled 设置为 false,则用户可以用鼠标对项目重新排序,但不能通过触摸方式。
相关文章推荐
- ListView.Items 属性
- ListView中item的最外层使用margin属性失效
- listview重要的几个属性
- listView几个重要属性
- Android中万能的BaseAdapter(Spinner,ListView,GridView)的使用!
- android之listView与gridView属性设置
- CalendarListview中自定义属性的翻译
- ListView之BaseAdapter的使用
- Android ExpandableListView几个特殊的属性
- android listview 属性详解
- PageBaseType属性的功用
- mysql Error Code: 1093. You can't specify target table 'base_extend' for update in FROM clause 0.001
- 最近在使用sps类库过程中发现了一个让我比较疑惑的问题(有关items属性的)
- ListView一些属性
- ListView中android:entries属性只能设置为string-array对象
- ListView显示和重写BaseAdapter的方法
- Android Listview通用适配器BaseCommAdapter
- View(视图)——ListView之BaseAdapter
- react native listview 一个有用的属性,用作两列布局
- Android 对Layout_weight属性完全解析以及使用ListView来实现表格