65.9K
CodeProject is changing. Read more.
Home

Detect Design Time Mode in WPF

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.81/5 (13 votes)

Feb 27, 2010

CPOL
viewsIcon

63627

In order to detect whether your application is executing as a result of being in a designer use the GetIsInDesignMode method of DesignerProperties as the following demonstrate.C#bool designTime = System.ComponentModel.DesignerProperties.GetIsInDesignMode( new...

In order to detect whether your application is executing as a result of being in a designer use the GetIsInDesignMode method of DesignerProperties as the following demonstrate.

C#

bool designTime = System.ComponentModel.DesignerProperties.GetIsInDesignMode(
    new DependencyObject());

VB.NET

dim designTime as Boolean = DesignerProperties.GetIsInDesignMode(
    New DependencyObject)