this.gridGroupingControl1.TableControlMouseDown += gridGroupingControl1_TableControlMouseDown;
void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e)
{
GridGroupingControl grid = sender as GridGroupingControl;
if (grid != null)
{
GridTableControl tableControl = grid.TableControl;
Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor columnDescriptor = gridGroupingControl1.TableControl.GetHeaderColumnDescriptorAt(e.Inner.Location);
if (columnDescriptor != null)
{
rightClickCol = columnDescriptor.HeaderText;
DragDropEffects ef = tableControl.DoDragDrop(rightClickCol, DragDropEffects.Copy);
}
}
}
textBox.AllowDrop = true;
textBox.DragDrop += TextBox1_DragDrop;
textBox.DragEnter += TextBox1_DragEnter;
private void TextBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text)) e.Effect = DragDropEffects.Copy;
}
private void TextBox1_DragDrop(object sender, DragEventArgs e)
{
var data = e.Data.GetData(DataFormats.Text);
if(data != null)
{
(sender as TextBox).Text = data.ToString();
}
} |
Hi Gregory,Thanks for using Syncfusion product.To drag and drop the column header text, you could handle the TableControlMouseDown event. Please refer the following code example and the modified sample.C#
this.gridGroupingControl1.TableControlMouseDown += gridGroupingControl1_TableControlMouseDown;void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e){GridGroupingControl grid = sender as GridGroupingControl;if (grid != null){GridTableControl tableControl = grid.TableControl;Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor columnDescriptor = gridGroupingControl1.TableControl.GetHeaderColumnDescriptorAt(e.Inner.Location);if (columnDescriptor != null){rightClickCol = columnDescriptor.HeaderText;DragDropEffects ef = tableControl.DoDragDrop(rightClickCol, DragDropEffects.Copy);}}}textBox.AllowDrop = true;textBox.DragDrop += TextBox1_DragDrop;textBox.DragEnter += TextBox1_DragEnter;private void TextBox1_DragEnter(object sender, DragEventArgs e){if (e.Data.GetDataPresent(DataFormats.Text)) e.Effect = DragDropEffects.Copy;}private void TextBox1_DragDrop(object sender, DragEventArgs e){var data = e.Data.GetData(DataFormats.Text);if(data != null){(sender as TextBox).Text = data.ToString();}}Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/test_ggc007625500763Please get back to us if you need any further assistance on this.Regards,Jagadeesan