WPF
if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
{
// Design Time Code
}
else
{
// Runtime Code
}
WindowPhone, Silverlight
if (DesignerProperties.IsInDesignTool)
{
// Design Time Code
}
else
{
// Runtime Code
}
Windows Store
if (DesignerProperties.DesignModeEnabled)
{
// Design Time Code
}
else
{
// Runtime Code
}