This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello I wonder if you have an example of or have some hints on how one would go about implementing drag and drop rearranging functionality in the WPF Elements DataGrid. Also, if possible, when displaying hierarchical data in the datagrid, it would be good to be able to limit the functionality so that you only can rearrange items on the same level (those that have the same parent). Here's an example that gives a hint of what i mean: http://www.codeproject.com/Articles/17266/Drag-and-Drop-Items-in-a-WPF-ListView Best regards |
|
|
Hello Nicklas, Unfortunately we don't provide this feature and don't have plans to add it currently. Your only option right now will be to try implement this over the top of the DataGrid. One thing you'll need is a Thumb in each data grid row for the user to drag them around. The easiest option for this would be to create a row-header template containing a thumb which will exisit in the left hand margin of each row. Next you'll need some way to know where each row is. This could be done by walking the visual tree and finding all the DataGridRow controls (this will just get you the rows within and close to the viewport). You could use the TransformToAncestor method on the row relative to the Data grid to get a common point of reference when implementing the mouse logic. You'll probably also want some kind of visual feedback for the user. A simple way for this again could be to add something to the row headers. Or an alternative would be to add some kind of overlay control over the data grid to display lines between the rows where the user is about to drop. Or create a custom row template and perhaps use attached-properties to cause them to highlight or display drop lines. Hope that helps. Let me know if you have any questions about the DataGrid, though note that I haven't tried this before. -Jason Fauchelle |
|