AnsweredAssumed Answered

Can I add an existing element as a child?

Question asked by Wepeng Yu on Dec 18, 2014
Latest reply on Dec 18, 2014 by Wepeng Yu


I have two elements: Object 1 and Object 2, as shown in pic1.JPG (pic1)

and I'm trying to move Object 2 as a child of Object 1 using AF SDK, the result I want is that:2.JPG(pic2)

 

However, I havn't figured out how to do this. If the code likes this:

AFElement Object1=AFDB.Elements["Object 1"];

AFElement Object2=AFDB.Elements["Object 2"];

Object1.Elements.Add(Object2);

// or  Object1.Element.Add(Object2, AFDB.ReferenceTypes["Parent-Child"]);

The result is like this:1.JPG(pic3)

if I add: Object2.Delete();    then both Object 2 and the reference of Object 2 are removed.

 

So, how can I get the result like pic2 ?

Outcomes