wpf 代码判断当前是否在设计模式,兼容没有UI线程的限制

        /// <summary>
        /// 当前是否处于设计模式
        /// </summary>
        bool IsInDesignMode
        {
            get
            {
                return (bool)DesignerProperties.IsInDesignModeProperty
                            .GetMetadata(typeof(DependencyObject)).DefaultValue;
            }
        }