Copying custom objects through Clipboard #5094
Unanswered
fabianoriccardi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would copy and paste a custom object between 2 instances of the same app, and I'm looking for simplest way, so, if possible, I would avoid "manual" serialization.
In WPF and Winform it was fine since I can use
Clipboard.SetDataObject()
,IDataObject
in combination withSerializable
attribute on my custom class (here an example). But in Windows App SDK, using DataPackage, I cannot find a similar alternative, and the only working method is the serialization in JSON (or whatever other char-based format) and passing the custom object as a simple string.Is there a similar API in WASDK as the ones present in WPF and WinForms?
I had tried the following:
But the line
dataPackage.SetData("my_format", person);
makes the app crash with message: "DataPackage doesn't support this type of data".Beta Was this translation helpful? Give feedback.
All reactions