Hello!
Yes, i did it in that way.
But, ID is used in connections... so i need restore ID each time,,,,
But there is another problem, when i drop object from treeview and create object via arg
args.Source = new NodeSFEx()
{
UnitHeight = 100,
UnitWidth = 200,
Name = tar.NameTech,
Content = tar,
ID = tar.Uid,
//Constraints=NodeConstraints.Default|~NodeConstraints.
Annotations = new AnnotationEditorViewModel()
{
Content = tar.NameTech,
},
ObjectUid = tar.Uid,
ObjectType = (int)NodeSFExTypes.Indicator,
};
where
public class NodeSFEx
: NodeViewModel
{
[DataMember]
public int ObjectType { get; set; }
[DataMember]
public Guid ObjectUid { get; set; }
[DataMember]
public string AddInfo { get; set; } = "";
}
But, when object added to diagram it has custom fields (and objectUID) are getting null...
Оbjects, that created proggramaticly working as expected..
For example, in event
(_Diagramm.Info as IGraphInfo).ItemAdded
custom props already null...
|
Query |
Response | |
|
Yes, i did it in that way.
But, ID is used in connections... so i need restore ID each time,,,,
|
In our SfDiagram control, if we use IDs for create Connection then internally we have update the SourceNode and TargetNode based on the SourceNodeID and TargetNodeID.
If you want to restore ID of the diagram element then use CustomID property to serialize and deserialize and assign its value to ID. We have prepared a simple sample for this requirement and attached the same below.
| |
|
when i drop object from treeview and create object via arg
when object added to diagram it has custom fields (and objectUID) are getting null...
Оbjects, that created proggramaticly working as expected..
|
In our SfDiagram control, we have clone the values of our default NodeViewModel properties alone. So for custom node you have to write clone functionality for the custom properties. Please find the code example below.
Code Example:
Please modify your custom node class based on the provided code example.
|