Saving/loading a block/group programmatically

How can I programmatically save a block/group to a file or stream?

You can save the whole diagram using SaveToStream/LoadFromStream. You can copy/paste selected blocks to the clipboard using CopyObjectsToClipboard and PasteObjectsFromClipboard. There is also a library manager feature where you can add blocks and group of blocks to a library and reuse them as if they are new blocks. But there is no such a feature for saving a block to stream, and I wonder why would you need it given the existing features previously mentioned?

We want to create our own library of blocks and manage it by just saving the information of newly blocks/groups created within the diagram component. The user would be able to create its block for future usage.


How the Diagram Studio component saves a single block/group information (not the whole diagram) and loads it? We want that information so this could be done in our own library.

Why don't you use the built-in library feature? That's the purpose of it, creating new blocks from existing ones.