在WPF中,有时需要判断当前是否处于设计模式,以屏蔽设计器执行构造函数里面的部分功能
public static bool IsInDesignMode(this Control control) { return System.ComponentModel.DesignerProperties.GetIsInDesignMode(control); }