Suppose you have 2 nodes. n1 is selected.
Can you explain me the mechanism that allows to set n1.IsSelected to false, when we click on n2 ?
In one case, when i perform paste, n1 is selected, but when I click on n2, n1 is not deselected. I should click in the diagram background after to deselect the both. And then selection works well.
I have binded the Part.IsSelected property with one of my model property.
At the end of CommandHandler.Paste, the IsSelected property is well defined, as my model property.
public override void Paste()
{
Diagram diagram = this.Diagram;
if (diagram == null) return;
Session.AppContext.CurrentEnvironment.Paste(null);
/* ====== we don't need this, it was just a try ====*/
QDiagramEnvironment DataContextDiagram = Session.AppContext.CurrentEnvironment as QDiagramEnvironment;
foreach (SphItem oItem in DataContextDiagram.SelectedItems)
{
QD_Node oNode = DataContextDiagram.QD_Model.FindNodeByKey(oItem.ID.ToString());
if (oNode == null) return;
Node oPart = this.Diagram.PartManager.FindNodeForData(oNode, DataContextDiagram.QD_Model);
if (oPart == null) return;
oPart.IsSelected = true;
}
/*=============*/
}
As you can see in the code, i don’t use the clipboard mechanism, but override all the copy/paste functions in my own commandhandler.