title: Drag and drop in DevExpress grid
body: <p>I'm trying to implement a drag and drop feature into a DevExpress Grid.  The first way I tried it didn't work, as the <code>dragdrop</code> method isn't getting hit.  Do I have to have it triggered by the <code>mouseDown</code> event, or how do I go about doing this.  Examples would be appreciated.  What I tried so far is this:</p>
  
  <pre><code>private void gridFields_DragDrop(object sender, DragEventArgs e)
  {
      GridControl grid = sender as GridControl;
      GridView view = grid.MainView as GridView;
      GridHitInfo srcHitInfo = e.Data.GetData(typeof(GridHitInfo)) as GridHitInfo;
      GridHitInfo hitInfo = view.CalcHitInfo(grid.PointToClient(new Point(e.X, e.Y)));
      int sourceRow = srcHitInfo.RowHandle;
      int targetRow = hitInfo.RowHandle;
      MoveRow(sourceRow, targetRow);
  }
  
  private void MoveRow(int sourceRow, int targetRow)
  {
      if (sourceRow == targetRow || sourceRow == targetRow + 1)
          return;
  
      GridView view = gridFieldView;
      DataRow row1 = view.GetDataRow(targetRow);
      DataRow row2 = view.GetDataRow(targetRow + 1);
      DataRow dragRow = view.GetDataRow(sourceRow);
      decimal val1 = (decimal)row1[OrderFieldName];
      if (row2 == null)
          dragRow[OrderFieldName] = val1 + 1;
      else
      {
          decimal val2 = (decimal)row2[OrderFieldName];
          dragRow[OrderFieldName] = (val1 + val2) / 2;
      }
  }
  </code></pre>