Windows Phone
Windows Phone

Reputation: 11

Save Observable Collection <T>

public class MyDoc
{
    public string Private {set;get;}
    public string Public  {set;get;}
}

public class MyFind
{
     public string Find {set;get;}
     public string News  {set;get;}

     private ObservableCollection<MyDoc> _smalllist;
     public ObservableCollection<MyDoc> SmallList
     {
       get
       {

         if (_smalllist == null)
         {
              _smalllist = new ObservableCollection<MyDoc>();
         }
         return _smalllist;
       }
       set
       {
          if (_smalllist != value)
          {
               _smalllist = value;
          }
       }
     }
}

public class Ask
{
     private ObservableCollection<MyFind> _Biglist;
     public ObservableCollection<MyFind> BigList
     {
       get
       {

         if (_Biglist == null)
         {
              _Biglist = new ObservableCollection<MyFind>();
         }
         return _Biglist;
       }
       set
       {
          if (_Biglist != value)
          {
               __Biglist = value;
          }
       }
     }
}

How can i save IsolatedStorage the Small list, and Big list ?

("Important : into the BigList need got 2 string and 1 ObservableCollection<> ").

We can see in class MyFind has got an ObservableCollection and 2 string in class MyAsk has got an ObservableCollection

Upvotes: 0

Views: 532

Answers (1)

Mohamed Abed
Mohamed Abed

Reputation: 5113

You need to create your own serializable observable collection as this: Check this http://kentb.blogspot.com/2007/11/serializing-observablecollection.html

another option is to crate IList backing fields and create a wrapping ObservableCollection properties marked as Non-Serializable

Upvotes: 1

Related Questions