Detecting Design-time in C#( Native DesignMode property not telling the full truth )
The DesignMode property for a UserControl object will show that it is in DesignMode only if the immediate parent is viewed in the IDE; if it is a grand child of the object that is being viewed in the IDE, then the DesignMode property will not be true.
The workaround:
///
/// Indicates if the current view is being utilized in the VS.NET IDE or not.
///
public new bool DesignMode
{
get
{
return (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv");
}
}
[ Via Mark Jordan's blog ]
