How to serialize control + code in WPF?

I have a canvas that contains several userControls, which in turn contains other objects. I want to serialize the canvas and save all data bindings and entire visual trees (not all objects can be described in xaml).

I thought creating a custom control that extends the canvas and adds serialization will solve this problem.

So the question is: is this correct? If not, what is the best way to do this?

+3
source share
2 answers

You should understand that your interface is just a way to show the status of your host. If you use Presentation Mode or MVVM , you can simply organize your presentation. He will solve all your problems.

0
source

I found one job. That is, to put the details of frivolous objects into a dictionary or other data structure and serialize them, and then retrieve them there when the object is de-serialized.

However, this is not very suitable for me: / I also thought of using both XamlWriter and serialization to serialize the controls, but again I do not think this is the best approach.

0
source

Source: https://habr.com/ru/post/1772438/


All Articles