By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,670 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,670 IT Pros & Developers. It's quick & easy.

DataGrid Drag'n drop

P: n/a
Hello

I'm trying to do basic drag and drop from DataGrid control. The problem
is that after I start DoDragDrop, items in DataGrid will become
unselected. I wish them to remian selected.

I hav such code:

private void dataGrid_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
System.Drawing.Point point = new Point(e.X, e.Y);
DataGrid.HitTestInfo hit= dataGridLista.HitTest(point);
if(hit.Type == DataGrid.HitTestType.Cell)
{
this.DoDragDrop(this.PozycjaRekorduWDatasecie,Drag DropEffects.None);

dataGridLista.CurrentCell = new DataGridCell(hit.Row, hit.Column);
dataGridLista.Select(hit.Row);
}
}
}

If I comment uot yhis.DoDragDrop, the item will be selected. Otherwise
it is on.

Note that I have to select whole row, not just one cell.

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I was able to fix it by using MouseMove event instead of MouseDown.

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.