0

I have a list of Grids with several rows and columns containing StackPanels. Each stack panel contains one or more Image objects, in some cases none at all and some Borders.

I would like to save these Grids to a file(sort of save functionality) and later get it back into memory and display it again.

What would be the best approach? Is there a way to do this operation in a simple way, or should I add every important data to the file, like the row and column count, StackPanel count, and how many Image objects are they having and each image with their position in the StackPanel and so on?

Edit: These Grid objects are created and managed completely in code-behind. I use the MVVM pattern throughout the project. (in case these are important to informations)

jikrthrttr
  • 11
  • 2
  • 2
    Why save a grid? Why not the underlying data model? Serialize it, write to disk and you're done. – Stefan Jun 04 '18 at 20:09
  • 1
    1. *"These Grid objects are created and managed completely in code-behind."* 2. *"I use the MVVM pattern throughout the project."* At most one of those two claims is true. Since you provide no detail or code at all, my guess is it's actually neither. – 15ee8f99-57ff-4f92-890c-b56153 Jun 04 '18 at 20:11
  • Don't get me wrong, as you can see from those claims, I'm clearly a beginner in WPF, and because those grids may and will come in different sizes, my approach was to create them in code-behind, since that way I could control their layout better. Another thing is that these grids may change in size (adding and removing rows and columns by the user) at runtime. – jikrthrttr Jun 04 '18 at 20:15

0 Answers0