当前位置: 首页 > 编程语言 > C#

DesignerProperties.IsInDesignMode和DesignerProperties.IsInDesignTool有什么区别?分享

时间:2023-04-10 23:48:44 C#

DesignerProperties.IsInDesignMode和DesignerProperties.IsInDesignTool有什么区别?DesignerProperties使用GetIsInDesignMode(element)和IsInDesignTool公开两个相似的设计状态。快速谷歌搜索显示IsInDesignTool似乎适用于Silverlight和ExpressionBlend。所以也许IsInDesignMode用于VS,但其他人需要IsInDesignTool。它们与IsInDesignTool完全相同,“如果元素在设计器的上下文中运行,则为真;否则为假。”IsInDesignTool的MDSDNGetIsInDesignMode(element)“元素的IsInDesignMode属性的值。”GetIsInDesignMode(element)的MDSDN然而,在每个蓝色月亮中,VisualStudio都会失败DesignerProperties.GetIsInDesignMode(this)因此最好使用returnDesignerProperties.GetIsInDesignMode(this)||DesignerProperties.IsInDesignTool;如果你不想让它崩溃。以上就是C#学习教程:DesignerProperties.IsInDesignMode和DesignerProperties.IsInDesignTool有什么区别?分享的所有内容,如果对你有用,需要了解更多C#学习教程,希望大家多多关注——.NetReflectorforSilverlightpublicstaticboolGetIsInDesignMode(DependencyObjectelement){if(element==null){抛出新的ArgumentNullException("元素");}布尔标志=假;如果(Application.Current.RootVisual!=null){flag=(bool)Application.Current.RootVisual.GetValue(IsInDesignModeProperty);}返回标志;}publicstaticboolIsInDesignTool{get{returnisInDesignTool;}[SecurityCritical]set{isInDesignTool=value;}}internalstaticboolInternalIsInDesignMode{[CompilerGenerated]get{returnk__BackingField;}[CompilerGenerated]设置{k__BackingField=值;}}不代表立场,如涉及侵权,请点击右边联系管理员删除。如需转载请注明出处: