The purpose of this Gist is to help provide a workaround to load a ViewModel into a Xamarin Forms View following a MVVM pattern that dynamically loads the ViewModel such as Prism. This example will be based on the use of such a project.
To Start Create a Build Profile in your Solution and any project containing your Views that you can use for Design Time. The name doesn't really matter, but for the purposes of this example we'll simply call it Design
. You may need to do some tweaking, but the most critical is that your project containing your Views and ViewModel's should be mapped to use the Design Build Profile when using the Solution's Build Profile. The Unit Tests do not have to be built in this profile but they can depending on your needs.
Next edit the build properties for the solution containing those Views and ViewModels. You will want to define a new Compiler
constant. If you copied the Debug
profile you should see constants already defined like DEBUG;TRACE;
.