Skip to content

Instantly share code, notes, and snippets.

@clausjoergensen
Created August 13, 2011 12:57
Show Gist options
  • Save clausjoergensen/1143826 to your computer and use it in GitHub Desktop.
Save clausjoergensen/1143826 to your computer and use it in GitHub Desktop.
public static class ViewModelLocator
{
private static MyViewModel myViewModel;
public static MyViewModel MyViewModel
{
get
{
if (myViewModel == null)
Deployment.Current.Dispatcher.BeginInvoke(() => myViewModel = new MyViewModel());
return myViewModel;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment