Dynamically change the shape of the icon


I am displaying some shapes in the palette. For example i display a block named Logical block in the palette.
After i drag and drop that block on to the diagram, using data inspector i would like to provide a feature to the user to change the shape of the image. When user selects a different shape by selecting from dropdown in datainspector then shape of the image should change automatically. For example after drag and dropping logical block i would choose AND shape in the dropdown in the property using datainspector and then the shape of the block should change to AND gate.

Any example please.

If you only needed to change the value of a Shape.figure, then it would be sufficient to have a Binding on that property to a data property that the user could modify.

But if you are using different templates for the different kinds of nodes that the user can choose from, that won’t work, because there are many structural differences between the nodes. So you will need to have the user modify the “category” property (or whatever you may have called it by setting Model.nodeCategoryProperty).