如何检查我是在运行时还是设计时? [英] How to check if i'm in run-time or design time?
本文介绍了如何检查我是在运行时还是设计时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发了一些 userControl,其中包含有关IsVisible"方法(覆盖方法)的一些信息检查.
I developed some userControl that contain some information check on the 'IsVisible' method ( override method ).
当我在某个窗口上使用这个用户控件时 - 我看到一些错误,因为 'IsVisible' 方法寻找一些在运行时设置的变量.
When i using this usercontrol on some window - i see some error because the 'IsVisible' method look for some variable that is set on run-time.
如何检查我是否处于设计时间并且系统没有运行?
How can i check if I'm in design time and the system is not running ?
感谢您的帮助.
推荐答案
DesignerProperties.GetIsInDesignMode(this);
如果您处于设计时,这将返回 true.
DesignerProperties.GetIsInDesignMode(this);
This would return true if you are in design-time.
这篇关于如何检查我是在运行时还是设计时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文