Skip to content

Instantly share code, notes, and snippets.

@Odonno
Created September 3, 2017 13:45
Show Gist options
  • Save Odonno/ce9deb076d8c791138b0b70c1958c3e3 to your computer and use it in GitHub Desktop.
Save Odonno/ce9deb076d8c791138b0b70c1958c3e3 to your computer and use it in GitHub Desktop.
Initialize ViewModel in GamePage of a C#/XAML MonoGame app
public GamePage(LaunchActivatedEventArgs args)
{
InitializeComponent();
// Add the data context
DataContext = ScoreViewModel.Instance;
// Create the game.
_game = XamlGame<Game1>.Create(args, Window.Current.CoreWindow, this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment