Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop my ViewModel code from running in the designer?

Tags:

I'm developing a networked WPF application with the MVVM pattern and it seems that it's running and connecting to servers in the designer.

I know about the IsInDesignMode property, but I'm not sure how to access it in a ViewModel.

like image 652
Brian Ortiz Avatar asked Sep 21 '10 05:09

Brian Ortiz


1 Answers

DependencyObject dep = new DependencyObject();
if (DesignerProperties.GetIsInDesignMode(dep))
{
    ...
}
like image 181
neolei Avatar answered Sep 23 '22 08:09

neolei