I am using drag and drop event to add nodes from SymbolPalette.
I would also like to support mouse double click or other hot keys for adding nodes on the diagram.
I have added event to handle double click event and in this event the node is added to the diagram. Following is the code snippet for the same.
private void listView_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var selectedPalette = ((System.Windows.Controls.Primitives.Selector)(sender)).SelectedItem as SymbolPaletteItem;
if (selectedPalette != null)
{
var node1 = selectedPalette.Content as Node;
if (node1 != null)
{
var node = Nodes.Nodes.GetNode(node1.Name);
DiagramView.Model.Nodes.Add(node);
}
}
}
Now my node is added to collection of nodes in the diagram control model. But I cannot see the ports associated with this node, nor I can select it using single click.
Am I missing on any of the steps while adding the node to diagram control.