views:

573

answers:

1

Hi all,

I have a class that inherits from ObservableCollection(Of MyObject) and the MyObject class handles INotifyPropertyChanged as it should. When the user updates this data through bound controls the collection will change as expected.

I have a 'Save' button on the form which is meant to persist this collection to disk as XML by calling MyObject.Save on each item. This logic has been written by me.

My question is, is this the preferred way of persisting objects or is there an attribute or interface I am missing that would tell the WPF databinding / .Net framework which method to use to save / load the data?

I ask because the WPF samples I have seen omit the saving and loading of real data so I am not sure.

Regards

Ryan

+2  A: 

I would not expect WPF to provide any data loading/saving capability beyond that provided by the .Net core, such as the standard serialization mechanisms.

You current approach seems fine if it fits your needs.

Daniel Paull