3 Replies - 458 Views - Last Post: 04 May 2016 - 10:14 AM Rate Topic: -----

#1 somecoder   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 04-March 16

Wpf / xml related issues

Posted 04 May 2016 - 04:09 AM

Hi all!

1. I know how to serialize and deserialize an object
2. I know how to open and save with proper dialogs.

I have a problem regarding linking XML and WPF controls

So basically i need to know how to load and save the XML file into a WPF control.

Sure thing starts with OpenFileDialog for loading and SaveFileDialog for saving but..
how do I connect the serializer and deserializer with open and save file dialogs to be able to, for example write couple of XML nodes in a textblock or any other control for that matter, and then save it as an XML.

or load that same XML back into a WPF control.

I'm sort of in a rush, so i'd be happy if someone could help me out!

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Wpf / xml related issues

#2 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7132
  • View blog
  • Posts: 24,225
  • Joined: 05-May 12

Re: Wpf / xml related issues

Posted 04 May 2016 - 06:11 AM

I'm sort of in a rush so connect the dots:
Take filename from open dialog.
Pass filename to deserializer and get back an object
Bind object to WPF control
When use indicates data needs to be saved, check if you have a filename
If you don't have a filename, take name from save dialog.
Pass filename to the serializer.
Was This Post Helpful? 0
  • +
  • -

#3 somecoder   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 04-March 16

Re: Wpf / xml related issues

Posted 04 May 2016 - 06:55 AM

View PostSkydiver, on 04 May 2016 - 06:11 AM, said:

I'm sort of in a rush so connect the dots:
Take filename from open dialog.
Pass filename to deserializer and get back an object
Bind object to WPF control
When use indicates data needs to be saved, check if you have a filename
If you don't have a filename, take name from save dialog.
Pass filename to the serializer.


First, thanks for contributing the topic, however is there a way to do it without binding?

We haven't learned this topic yet.
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7132
  • View blog
  • Posts: 24,225
  • Joined: 05-May 12

Re: Wpf / xml related issues

Posted 04 May 2016 - 10:14 AM

To use WPF the way it was designed, you should be using binding.

You could use some code to set the WPF text/UI elements programatically, but why your teacher is teaching you this technique is very puzzling (and troubling).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1