I'm working with drag and drop from another control in my application. When I hold down the ctrl key, the text item copies from the other control into the syntax editor. Is there an easy way to get this to work without the user having to hold down the ctrl key?
I have been investigating into your requirement in this case, and I believe I will need a little more information on what exactly this “other control” that you are dragging from is. Would it be possible for you to please provide some information regarding that?
I ask, as I have put together a very simple sample project on my end that drags from a TextBox, and the Ctrl key is not required to “copy-drag” the selected text of the TextBox to the XamSyntaxEditor.
Please let me know if you have any other questions or concerns on this matter.
Thanks for the response. So when I do what you describe, and drag from a textbox to the xamsyntaxeditor, it performs a "move" and pastes the text correctly into the xamsyntaxeditor while removing it from the textbox. If I do the same from the textbox with the ctrl key down it performs a "copy".
My real issue is when dragging from a listbox control (which contains a list of strings), so I am essentially dragging in a string. When trying to drag without ctrl key pressed, I am unable to drop. When I hold down the ctrl key it lets me drop on the xamsyntaxeditor. Hopefully you can re-create this in your sample project. If not, let me know and I'll put together a sample project.
I have put together a sample project using a ListBox instead, and I am still not able to see this Ctrl copy behavior that you are referring to. Perhaps there is some setting that I am missing? I am attaching the sample project I am using to test this.
If you are looking to drag without the Ctrl key and the Ctrl key drag is something that is built-in to the ListBox in this case, the best thing I can recommend is to implement your own drag-drop functionality between the ListBox and the XamSyntaxEditor. There is a good example here about dragging between two ListBoxes that I think may help you, as if you modify this to be between the XamSyntaxEditor and the ListBox instead, I believe you can achieve your requirement.
I've put together a sample project which represents what is going on in our project. We use the "ATLDragAndDrop" class for all out listboxes and it allows us to drag to any other control from a listbox without holding the ctrl key.
I've put together a sample solution but I am unable to attach it. I've tried a few different browsers and it keeps giving an error.
Please let me know how to get the sample to you. Thanks
Still waiting on how to get you the sample project I've put together. Thanks