When Ctrl+C to copy diagram is null

Binding functions second param I named it obj, when I press Ctrl + C to copy it , the obj.diagram is null
why it null, and how to avoid it?
the sample code is here,

select the node and press Ctrl + C you can reproduce it.

I think that the copied Node (and thus its TextBlock) is not in any Diagram.

Your binding conversion function will need to handle that case.

Understood. When the diagram is null, we simply return some dummy text, which I believe should not have any side effects. After all, in real-world situations, we aren’t just binding text, but any property.

However, when I press the Ctrl key and drag, the node is also copied, but in this case, the diagram isn’t null. This results in a different behavior.

We could solve this issue in a certain way, but it makes the code look rather strange.

Yes, a control-drag while the mouse is in a diagram has a known target – it is copying parts within that diagram. But copying to the clipboard means the parts cannot be associated with any existing diagram – they could then be pasted into any diagram, including ones that do not yet exist, and the source diagram could be destroyed before the paste happens.

thank you walter, I wrote some, work around code solve it.