Please tell me how best to make the save in my program? I will save all the elements from the canvas (it is in the picture), saving the child objects and all their properties ( tag , name , events, if any, margin , etc.), and besides the graphic elements I also need to save the list (which there is also), which consists of classes, as an example I gave one class and bundles (red arrows) that will be there. I wanted to save everything in xml, but I don’t know whether to do it right?

enter image description here


enter image description here

  • 2
    You should not want to keep the UI structure. You should have a [view-] model, meaningful object, the display of which is your UI, and it should be saved. UI should be built on this object. - VladD
  • @VladD Wait, you can in a bit more detail about the "[view-] model, meaningful object," I just add all controls using canvas.Children.Add, and inside added controls I add other controls in a similar way. - alex-rudenkiy
  • @VladD Well, ok, well, then how can I save the view model? - alex-rudenkiy
  • Well, have to do wrong. For example, you should have a list of VM objects, and a UI will automatically be built on it (via some ItemsControl ). Building a UI manually means restricting WPF to WinForms. - VladD
  • And for model or VM objects that need to be saved, implement XML serialization (or JSON serialization, so now it seems to be more fashionable). - VladD

0