We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Drag and Drop in WPFGridDataControl?

Thread ID:

Created:

Updated:

Platform:

Replies:

99953 Jun 22,2011 06:24 AM Nov 2,2011 01:43 PM General Discussion 9
loading
Tags: General Discussion
Tun Nwe Aung
Asked On June 22, 2011 06:24 AM

Hi,

Do you have any code snippet of drag-drop feature for GridDataControl? Eg. I want to move 5th row to first. Thanks.


Deenadhayalan M [Syncfusion]
Replied On June 23, 2011 05:56 AM

Hi Tun,

Sorry for the inconvenience caused.

Currently, Our GridDataControl doesn't support for Drag and drop the rows. We can drag and drop the columns. But you can Move the Row using MoveRows property as follows,

Code snippet [C#] :
this.datagrid.Model.MoveRows(5, 1, 1);

We have prepared a sample based on this. Please find the sample in the following location.

Regards,
Deenadhayalan



99715_GridDataVisible_61437dee.zip

Tun Nwe Aung
Replied On June 23, 2011 09:50 PM

Thank you for your reply. But, After clicking on Move Button, if you click on the cell, it goes back to the original state.

Eg. Before clicking "Move"
1
2
3
4
5
After clicking "Move"
5
4
3
2
1

But , If you click on each cell at that time, it changed back to 1,2,3,4,5 again. Please advise. Thanks.



Tun Nwe Aung
Replied On June 23, 2011 10:28 PM

And, plus this, In my GridDataControl, I added ScrollViewer.CanContentScroll="True" , so that I can see the scrollbar in the grid. But, Is there any way to move this scrollbar up and down programatically? I'm really stuck in this stage and much appreciate if you can help it out. Please advise. Thank you.


Tun Nwe Aung
Replied On June 28, 2011 12:29 AM

Scrolling problem is solved , just left the MoveRows issue. Thanks.


Deenadhayalan M [Syncfusion]
Replied On June 29, 2011 12:14 AM

Hi Tun,

Sorry for the inconvenience caused.

The MoveRows method useful to see the item visually at particular position. To move the row permanently to a particular position, you need to modify the item position of underlying Collection as follows,

private void Button_Click(object sender, RoutedEventArgs e)
{
if (this.datagrid.Model[5, 0].CellValue.ToString() == "Carl")
{
Collection.Move(4, 0);
}
}

We have prepared a sample based on this. Please find in the following location.

Please let us know if you have any queries.

Regards,
Deenadhayalan



99715_GridDataVisible_MoveRows_b803ca9b.zip

Tun Nwe Aung
Replied On June 29, 2011 04:26 AM

Thank you for your reply. Yes, this is the problem I'm facing right now. If you want to change the underlying collection, you have to set the AllowSort to fasle. If you want to sort, you cannot move. Is there anything that makes both to work simultaneously. Once again, thank you for your reply.


Ramesh V [Syncfusion]
Replied On July 1, 2011 09:13 AM

Hi Tun,

Sorry for the inconvenience caused.

At present there is no support to change the underlying collection item positions and also Sorting at the same time. We can perform any one at a time.

Please let us know if you have any queries.

Regards,
Ramesh



Michael Culley
Replied On October 6, 2011 08:18 PM

You can drag and drop rows if you implement drag and drop functionality yourself. This isn't 100% straight forward but not too difficult. See the attached sample, it is demonstrating dragging from a grid on the left to one on the right but it would be a simple modification to drag from a grid to itself. Note that in some cases you get 2 drop events but this is something I have raised with support. It's fairly easy to set a flag to ignore the second event.



SFGridDragDrop_585e7438.zip

Jawahar Jeevanandan J [Syncfusion]
Replied On November 2, 2011 01:43 PM

Hi Michael,

Thanks for your patience.

The query reported in this forum has been addressed in incident 85682. Please follow incident 85682 incident for further follow up.

Please let us know if you have any queries.

Thanks,
Jawahar.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;