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. Image for the cookie policy date

Highlining current row on DragOver event GridTreeControl

Hello,

I have a problem with highlining current row on DragOver event.

I have tryied something like this, but it doesn't work:
       
 int hoveredIndex = -1;

private void AssociatedObject_DragOver(object sender, DragEventArgs e)
        {
            Point p1 = e.GetPosition(this.AssociatedObject.InternalGrid);
            RowColumnIndex rc = this.AssociatedObject.InternalGrid.PointToCellRowColumnIndex(p1);
            hoveredIndex = rc.RowIndex;
        }

        private void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
        {
            if (e.Style.RowIndex == hoveredIndex)
            {
                e.Style.Background = System.Windows.Media.Brushes.Black;
            }
        }



1 Reply

JG Jai Ganesh S Syncfusion Team June 16, 2016 01:48 PM UTC

Hi John, 
 
You can highlight the current row on DragOver event by call the InvalidateMeasure method like below, 
 
  private void TreeGrid_DragOver(object sender, DragEventArgs e) 
     { 
            Point p1 = e.GetPosition(this.treeGrid.InternalGrid); 
            RowColumnIndex rc = this.treeGrid.InternalGrid.PointToCellRowColumnIndex(p1); 
            hoveredIndex = rc.RowIndex; 
 
            this.treeGrid.InternalGrid.InvalidateMeasure(); 
      } 
 
If you still facing the issue, then could you please share the whole code for doing drag and drop in your application? This would be more helpful for us to analyze further. 
 
Regards, 
Jai Ganesh S 


Loader.
Live Chat Icon For mobile
Up arrow icon