Shape Tag

Jul 14, 2013 at 11:25 AM
Edited Jul 14, 2013 at 11:27 AM
Hello Mr Kurt


I want To ask, about shape when i set tag to shape and i saved diagram using :
project1.Repository.SaveChanges();
and i closed the project and i opened again i want check tag of the shape why tag not saved,How to saved tag every shape where i set in diagram please help Thanks you very much




Best Regards


Sonson
Coordinator
Jul 15, 2013 at 12:05 PM
Hello Sonson,

the Tag property of shapes will not be saved. This is not a bug, it's a design decision.
Reasons for this decision:
  • The Tag property is not saved because it is meant as temporary storage property for user defined data.
  • As the Tag property is of type object and you can assign anything you want to it, there is no proper way for the NShape framework how to serialize / deserialize this property
If you need to store custom data in your shapes, you have to derive your own shape and implement the following methods:
  • GetPropertyDefinitions(int version) (this is a static method)
  • LoadFieldsCore
  • SaveFieldsCore
See documentation "Programmer Tasks > Developing a New Shape Class > Adding Persistency Support > Implementing the Load Method" or the base classes implementations for details.