How can I implement OLE Drag & Drop between a DataGrid and another OLE DnD object that supports the Text format
The attached samples (C#, VB) have a derived datagrid that supports OLE D&D with any OLE D&D provider that handles a Text formatted data object. The derived grid handles six events to allow it to be both a drop source and a drop target. The sample project has two datagrids where you can drag cell text back and forth. You can also open Excel, and drag text between Excel and either datagrid. Here are the events that are handled in this sample. MouseDown – Used to save the row and column of a mousedown, ’mousedowncell’. MouseMove – Checks to see if you drag off the mousedowncell, and if so, starts a the DoDragDrop. MouseUp – Used to reset the mousedowncell. DragEnter – Checks to see if the data object has text, and if so, allows a Copy operation. (This could be changed to support Move/Copy.) DragOver – Used to set a NoDrop cursor if you move over the mousedowncell (if mousedowncell has been set). DragDrop – Used to drop the text into the datagrid.
Is there an easy way to Create/Delete/Move files in the Windows File System?
Use File.Create, Delete and Move static methods.
I lost the settings in my DataGrid set during design-time?
This is possible if you assign a custom DataGridTableStyle to the DataGrid. The properties in the DataGridTableStyle will then replace certain properties in the DataGrid. Take a look at DataGrid class reference for a list of these properties.
How do I create an editable listbox with an in-place TextBox and Button?
The attached EditableList UserControl implements an editable listbox with an in-place TextBox and Button allowing users to directly edit the contents of the list box. When the user clicks on a selected item, a textbox and a button is shown over the selected item and the user can directly edit the selected item text. The button can be programmed to show for example a OpenFileDialog to allow user to select a file (useful while implementing a Files list).
How can I move rows by dragging the row header cell
One way to implement this is to derive a DataGrid and override the virtual OnMouseDown, OnMouseMove and OnMouseUp methods. In your overrides, if the mousedown is on a row header, track the initial mousedown row, and as it moves, draw a line to indicate a target position. Then on the mouseup, handle moving the row. You can download a sample (C#, VB) that illustrates how this might be done.