Silverlight DataGrid 选择和拖放
我目前正在使用 Silverlight SDK 中提供的 DataGrid 实现拖放,我希望用户能够轻松地将多个项目拖到另一个列表中。
网格的选择会在 MouseDown 事件上更新,因此用户拖动多个项目的唯一方法是在开始拖动操作时按 Shift。这并不是很明显,对我来说,自然的方法应该是单击选定的行块并拖动它们。为此,需要在 MouseUp 事件上更新选择。
我尝试从 DataGrid 派生来注入我的自定义 DataGridRows,但 DataGrid 没有公开替换它创建的行类型的方法。
有人对此有解决方案或想法吗?
谢谢你,
雅克。
I am currently implementing drag and drop using the DataGrid provided in the Silverlight SDK and I want the user to be, easily, able to drag multiple items to another list.
The grid's selection gets updated on the MouseDown event so the only way the user have to drag multiple items is to press Shift while begining the drag operation. This is not really obvious and, for me, the natural way whould have been to just click the selected block of rows and drag them. To do so, the selection needs to be updated on the MouseUp event.
I've tried to derive from the DataGrid to inject my custom DataGridRows but the DataGrid doesn't expose a way to replace the type of rows it creates.
Anyone have a solution or ideas for this?
Thank you,
Jacques.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,不幸的是,选择是在鼠标按下时更新的。您需要在 mousedown 事件中执行一些工作来解决此问题。这篇 codeproject 文章应该有所帮助:
http:// /www.codeproject.com/Tips/338594/Drag-drop-multiple-selected-rows-of-datagridview-w
Yes, it's unfortunate that the selection is updated on mousedown. You will need to perform some work in the mousedown event to work around this. This codeproject article should help:
http://www.codeproject.com/Tips/338594/Drag-drop-multiple-selected-rows-of-datagridview-w