Question

The Universal App template has sample data in JSON and a SampleDataSource that loads that JSON file and provides a model. This is nice but I'm using MVVM and I need the PropertyChange Notifications.
My aim is this

DesignTime

  • Load Sample Data from a json file (my webservice provides data in JSON so this is super helpful)
  • Display the sample data in my UI

RunTime

  • Load JSON (well PBF really) data from my live webservice
  • Display Real Data in my UI

I'm struggling to understand how the databinding is meant to work in design time.
Should I have code to load and process the JSON into a model?
My JSON converts into my DataModel not my ViewModel, is this supported in the SampleData infrastructure?

Était-ce utile?

La solution

I've decided against using the JSON approach since the model conversion is so basic as to be worthless in a real application. You essentially have to have a JSON file that maps precisely to the model with no exceptions which requires a very trivial model. I'm going back to XAML :(

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top