Serialize a binded ObservableCollection (with BinaryFormatter)??


  • Hi!

    Do you know why I can't serialize a binded ObservableCollection with BinaryFormatter??

    I tried with xml-serialization and it works fine! But with BinaryFormatter, I have following error:

    Code Block

    [1616] Type 'System.Windows.Data.ListCollectionView' in Assembly 'PresentationFramework, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.

    And when I remove the "OnPropertyChanged" of my ObservableCollection property, it works....

    You can download a test-project here :

    --> commented code works fine ;-) (with xml-serialization!)

    Thx for help!

    Monday, October 15, 2007 2:11 PM

All replies

  • Hello,


    The problem is caused by INotifyPropertyChanged interface, but so far I didn't find why...

    Besides don't forget to close the stream in the catch statement, cause file than is inaccessible.





    Monday, October 15, 2007 3:59 PM
  • oups... yeah sorry for stream close
    Monday, October 15, 2007 4:06 PM
  • Hi,

    Serialization  Surrogates is the answer :)

    Think this might help you

    Thank you

    • Edited by Rahul P Nath Wednesday, October 22, 2008 1:20 PM
    • Proposed as answer by Rahul P Nath Wednesday, October 29, 2008 3:54 AM
    Wednesday, October 22, 2008 12:22 PM