我正在使用MVVM模式开发一个联网的WPF应用程序,它似乎正在运行并连接到设计器中的服务器。
我知道IsInDesignMode属性,但不确定如何在ViewModel中访问它。
最佳答案
DependencyObject dep = new DependencyObject();
if (DesignerProperties.GetIsInDesignMode(dep))
{
...
}
关于wpf - 如何停止ViewModel代码在设计器中运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3757646/