Hi, I am using a FastObjectListView in a Windows Form which has several TextBoxes. I want to be able to drag an item (model object) from the ObjectListView and extract the text of one of the fields (columns) in that object to insert it into the TextBox(es). I know how to do the TextBox insertion once I get the text of the dragged field, but how do I set up the ObjectListView to alllow this and which events do I need to implement?
The ObjectListView also allows rows to be rearranged thus:
olvFields.DragSource = new SimpleDragSource();
olvFields.DropSink = new RearrangingDropSink(false);
Can I use both drag/drop operations on the same ObjectListView without them interfering with each other and if so, how?
Thanks very much.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So, depending on which text box is the target of the drop, you would like a different column of information to be added to the text box?
If so, you will need to write drop handlers for the text fields. In the Drop event handler, you will have to cast the args.Data into a OLVDataObject. If the data field is an OLVDataObject object, you can look at the ModelObjects property to see which model objects were being dragged.
Yes, you can use the rearranging and the dropping functionality at the same time.
You might have to do some research into how drag and drop works in WinForms.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I am using a FastObjectListView in a Windows Form which has several TextBoxes. I want to be able to drag an item (model object) from the ObjectListView and extract the text of one of the fields (columns) in that object to insert it into the TextBox(es). I know how to do the TextBox insertion once I get the text of the dragged field, but how do I set up the ObjectListView to alllow this and which events do I need to implement?
The ObjectListView also allows rows to be rearranged thus:
olvFields.DragSource = new SimpleDragSource();
olvFields.DropSink = new RearrangingDropSink(false);
Can I use both drag/drop operations on the same ObjectListView without them interfering with each other and if so, how?
Thanks very much.
So, depending on which text box is the target of the drop, you would like a different column of information to be added to the text box?
If so, you will need to write drop handlers for the text fields. In the Drop event handler, you will have to cast the
args.Datainto aOLVDataObject. If the data field is anOLVDataObjectobject, you can look at theModelObjectsproperty to see which model objects were being dragged.Yes, you can use the rearranging and the dropping functionality at the same time.
You might have to do some research into how drag and drop works in WinForms.