DragDropGridEventArgs.GetDragDropGridEventArgs(DragDropEventArgs) Method
In This Article
Calculates grid-specific event arguments.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v24.2.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
#Declaration
public static DragDropGridEventArgs GetDragDropGridEventArgs(
DragDropEventArgs e
)
#Parameters
Name | Type | Description |
---|---|---|
e | Drag |
An object that contains event arguments. |
#Returns
Type | Description |
---|---|
Drag |
An object that contains grid-specific event arguments. |
#Example
The example below shows how to copy data from a tree list to a grid.
using DevExpress.Utils.DragDrop;
//The code below assumes that you are moving data from a tree list to a grid.
//Create new grid rows, and populate them with data from tree list nodes.
private void dragDropEvents1_DragDrop(object sender, DragDropEventArgs e) {
List<TreeListNode> list = e.Data as List<TreeListNode>;
foreach (TreeListNode node in list) {
gridView1.AddNewRow();
gridView1.SetRowCellValue(GridControl.NewItemRowHandle, gridView1.Columns["DEPARTMENT"], node.GetValue(colDEPARTMENT1));
}
e.Handled = true;
}
Note
When you handle the DragDrag
method to calculate arguments specific to the grid view.
using DevExpress.Utils.DragDrop;
using DevExpress.XtraGrid.Views.Grid;
dragDropEvents1.DragDrop += Behavior_DragDrop;
private void Behavior_DragDrop(object sender, DragDropEventArgs e) {
DragDropGridEventArgs args = DragDropGridEventArgs.GetDragDropGridEventArgs(e);
//You can also cast DragDropEventArgs to DragDropGridEventArgs.
//DragDropGridEventArgs args = (DragDropGridEventArgs)e;
}
Note
Run the Xtra
See Also