Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
400
drag and drop in the rows within the same ultragrid
posted

Drag and drop with in the same ultragrid..i have tried with this code...but it is not working..can any one give me correct  sample code solution with explanation . 


private void ultraGrid1_SelectionDrag(object sender, CancelEventArgs e)
{
ultraGrid1.DoDragDrop(ultraGrid1.Selected.Cells, DragDropEffects.Copy | DragDropEffects.Move);
// e.Cancel = true;
}
private void ultraGrid1_DragOver(object sender, DragEventArgs e)
{
if (e.Data.GetData(typeof(SelectedCellsCollection)) != null)
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}

private void ultraGrid1_DragDrop(object sender, DragEventArgs e)
{
int dropIndexRow, dropIndexCol;
UIElement uieOver = ultraGrid1.DisplayLayout.UIElement.ElementFromPoint(ultraGrid1.PointToClient(new Point(e.X, e.Y)));
UltraGridRow ugrOver = uieOver.GetContext(typeof(UltraGridRow), true) as UltraGridRow;
UltraGridColumn ugrOverCol = uieOver.GetContext(typeof(UltraGridColumn), true) as UltraGridColumn;
if (ugrOver != null)
{
dropIndexRow = ugrOver.Index;
dropIndexCol = ugrOverCol.Index;
SelectedCellsCollection SelCells;
SelCells = (SelectedCellsCollection)e.Data.GetData(typeof(SelectedCellsCollection));
ultraGrid1.Rows[dropIndexRow].Cells[dropIndexCol].Value = SelCells[0].Value;

}
}
}

Parents
No Data
Reply Children