var prop = System.ComponentModel.DesignerProperties.IsInDesignModeProperty; bool isInDesignMode = (bool)System.ComponentModel.DependencyPropertyDescriptor .FromProperty(prop, typeof(FrameworkElement)) .Metadata.DefaultValue;
摘自 Simple MVVM Toolkit