Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Drag&Drop WPF #942

Open
Bert1974 opened this issue Jun 5, 2019 · 0 comments
Open

Drag&Drop WPF #942

Bert1974 opened this issue Jun 5, 2019 · 0 comments

Comments

@Bert1974
Copy link

Bert1974 commented Jun 5, 2019

To allow drag&drop files from explorer i had to handle Uri[] also in ToDataObject

namespace Xwt.WPFBackend
{
internal static class DataConverter
{
public static DataObject ToDataObject (this TransferDataSource data)
{
var retval = new DataObject ();
foreach (var type in data.DataTypes) {
var value = data.GetValue (type);

			if (type == TransferDataType.Text)
				retval.SetText ((string)value);
			else if (type == TransferDataType.Uri) {
				var uris = new StringCollection ();

<<<<<<<<<<<
if (value is Uri[]) {
foreach (var uri in value as Uri[])
uris.Add(uri.LocalPath);
}
else
<<<<<<<<<<<<
uris.Add (((Uri)value).LocalPath);
retval.SetFileDropList (uris);
} else
retval.SetData (type.Id, TransferDataSource.SerializeValue (value));
}

		return retval;
	}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant