Move a shape from one group to another

How do I move a shape from one group to another ?
I tried this, but it does not work. The shape is removed from the source group, but it is not added to the destination group.

Shape shape = groupSource.Shapes.GetShape(1);
groupSource.Shapes.Remove(shape);
groupDestination.Shapes.Add(shape);

@zkormos
Thank you for your inquiry.
Please try this sample code to add shape first:
Shape shape = groupSource.Shapes.GetShape(1);
groupDestination.Shapes.Add(shape);
groupSource.Shapes.Remove(shape);

If you still have this issue, please create a standalone console application with the sample file, zip the project and post us, we will check it soon.
Thanks.

1 Like