Can Part properties in ForeGround be bound to ModelData?

I have added a static part in ForeGround Layer or a new layer above ForeGround. Part template has binding for visible property bound to a object in ModelData (.ofModel()). But the bindings are not working. Is there any setting that will help here?

The easiest solution is to add a node data object in the model, using a new category/template that is a Part with the Binding(s) that you want.

Wouldn’t this get included in diagram.model.toJson()? I do not want to persist this static part in the database.
I see tojson() does not include parts added by digram.add(part). But I want this part also to be on top of all other parts and in a static position top-right corner of the canvas.

Yes, if it’s in the model, it would be produced in the Model.toJson output.

But you could temporarily remove it (without calling Model methods) from the Model.nodeDataArray, call Model.toJson, and then put it back.

Or you could remove it just before saving it in your database.

Or you could implement your own serialization.

Or you could just add the Part to the Diagram as you are now, and set its After you have updated any data properties, you’ll need to call Part.updateTargetBindings. Example: Unmodeled Data

Everything else stays basically the same as it is now.

Did you want its data changes to be recorded by the UndoManager? It occurs to me that you probably don’t. Since you didn’t want the data to be in the model, it would make sense if neither changes to the data nor changes to the Part be recorded in the UndoManager. I have updated the sample accordingly: Unmodeled Data