A class (used later as datacontext) :
[Serializable]
public class CMiXData : INotifyPropertyChanged
{
public CMiXData() { }
private ObservableCollection<string> _ChannelsSpriteCount = new ObservableCollection<string>(new[] { "1", "1", "1", "1", "1", "1" });
public ObservableCollection<string> ChannelsSpriteCount
{
get { return _ChannelsSpriteCount; }
set { _ChannelsSpriteCount = value; }
}
Some usercontrol
bind to the property ChannelsSpriteCount
of this class and the saved json
once serialized may look like this :
{"ChannelsSpriteCount":["32","4","8","64","2","4"]}
When I load and deserialized the json file this way :
private void Load_Click(object sender, RoutedEventArgs e)
{
this.DataContext = JsonConvert.DeserializeObject<CMiXData>(File.ReadAllText(@"C:\Users\BabyClone\Documents\cmix.json"));
MessageBox.Show(cmixdata.ChannelsSpriteCount[0]);
Whatever the values I can see inside the saved file, what's loaded is always the default value from the original class : in this case "1"
...
What am I missing here ?