Category / Section
How to Notify when diagramming object is duplicated with source in WPF Diagram (SfDiagram)?
1 min read
WPF Diagram (SfDiagram) provides support to get the Source for the Duplicated Object in ItemAddedEvent. We have provided info property as an argument of ItemAddedEvent. Please refer to the below table for the arguments of ItemAddedEvent.
S.no | Property | Description |
1. | SourceId | Defines the ID of the Source object of the Duplicate object. |
2. | SourceCollection | Defines the Collection of Source object of the Duplicated object. |
3. | PastedCount | Defines the Count of Duplicated Object. |
GetObject:
“GetObject” is a method of IGrapInfo is used to find the Source object based on ID property. We have provided code example to get the Source Object of duplicate object using GetObject method.
C#
//ItemAddedEvent void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args) { if (args.ItemSource == ItemSource.ClipBoard) { object b; if (args.Info != null) { //Method is used to get the Diagramming object based On ID b = (diagramcontrol.Info as IGraphInfo).GetObject(args.Info.SourceId); } } }