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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drag and drop doesn't always drop row to the indicated drop position

Thread ID:

Created:

Updated:

Platform:

Replies:

128748 Feb 9,2017 06:26 AM UTC Mar 2,2017 09:03 AM UTC Xamarin.Forms 4
loading
Tags: SfDataGrid
Andrew Macdonald
Asked On February 9, 2017 06:26 AM UTC

When dragging-and-dropping a row lower down in a Xamarin Forms SfDataGrid, the row is inserted one position lower than the indicated drop position. This is reproducible in the Sample Browser. It works correctly when dragging higher up the list.

The QueryRowDraggingEventArgs .To parameter in the QueryRowDraggingEvent is similarly off by one when dragging down (except when dropping below the last row).


Divakar Subramaniam [Syncfusion]
Replied On February 10, 2017 07:21 AM UTC

Hi Andrew, 
 
 
We have considered your query as a defect and we are currently working on it.  
 
A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates    
 
 
Regards, 
Divakar. 
 


Emil
Replied On March 1, 2017 01:36 PM UTC

As i know sfdatagrid Starts from row number =1 instead of 0. Did you check that?

Andrew Macdonald
Replied On March 1, 2017 10:49 PM UTC

Emil,

Yes, it wasn't that. The interface drag-and-drop had a bug which Syncfusion has fixed and will be available in the 2017 Volume 1 SP1 release.

However the code-behind QueryRowDraggingEventArgs.To parameter still has the same unexpected behavior. That is, it returns the same index value when dropping below either the second-last row or the last row of the Grid. SyncFusion provided a solution that uses the QueryRowDraggingEventArgs.Position.Y parameter to distinguish those two scenarios. Here's the code in case it's useful to anyone else.

public int LastIndex 

    get 
    { 
        return (dataGrid.GroupColumnDescriptions.Count > 0 
            ? this.dataGrid.View.TopLevelGroup.DisplayElements.Count 
            : this.dataGrid.View.Records.Count); 
    } 

 
private void DataGrid_QueryRowDragging(object sender, QueryRowDraggingEventArgs e) 

    if (e.Reason == QueryRowDraggingReason.Dragging) 
    { 
        var totalHeight = dataGrid.RowColumnIndexToPoint(new RowColumnIndex(this.LastIndex, 0)).Y + this.dataGrid.RowHeight; 
        if (Math.Ceiling(e.Position.Y + (dataGrid.RowHeight * 0.45)) 
            > totalHeight && e.To == LastIndex) 
        { 
            // Will hit if RowDragView move below the last row.  
        } 
    } 


Vimal Prabhu Manohkaran [Syncfusion]
Replied On March 2, 2017 09:03 AM UTC

Hi Emil,

As stated by Andrew, the fix for the reported issue is available in the 2017 Volume 1 Service Pack 1 release. Hence requesting you to update the Syncfusion nugets to the latest version. Also, please use the below workaround to achieve your requirement of getting notification when dragged below the last row. We are currently preparing UG documentation for the same which will be updated at the earliest. 
 
  
Andrew, thank you for the time and efforts for coming up with that reply to Emile.  

Regards,
Vimal Prabhu


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.

Warning Icon 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.Close Icon

;