DesignMode
DesignMode
DesignMode
DesignMode
Class
Definition
Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Prerelease APIs are identified by a Prerelease label.
[Contains prerelease APIs.]
Enables you to detect whether your app is in design mode in a visual designer.
public : static class DesignModepublic static class DesignModePublic Static Class DesignMode// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Remarks
Visual designers like Microsoft Visual Studio and Blend for Microsoft Visual Studio 2013 enable you to build UI for Windows Store app by editing activated instances of your custom types. Design tools create an instance of your app in a special authoring mode, known as design mode. When your app runs in design mode, it can execute special logic that enables coordination with the visual designer.
Properties
DesignMode2Enabled DesignMode2Enabled DesignMode2Enabled DesignMode2Enabled
Prerelease. Used to enable or disable user code inside a XAML designer that targets the Windows 10 Fall Creators Update SDK, or later.
public : static PlatForm::Boolean DesignMode2Enabled { get; }public static bool DesignMode2Enabled { get; }Public Static ReadOnly Property DesignMode2Enabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
True if called from code running inside a XAML designer that targets the Windows 10 Fall Creators Update, or later; otherwise false.
| Device family |
Windows 10 Insider Preview (introduced v10.0.16257.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v5)
|
Examples
The following code only executes when running inside a XAML designer, regardless of the version of the SDK that the XAML designer targets. We recommend this check for most users.
if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
{
// Code to execute when running inside a XAML designer, regardless of the SDK the designer targets.
}
The following code only executes when running inside a XAML designer that targets the Windows 10 Fall Creators Update SDK or later.
if (Windows.ApplicationModel.DesignMode.DesignMode2Enabled)
{
// Code to execute when running inside a XAML designer that targets the Fall Creators Update SDK, or later.
}
Remarks
Windows.ApplicationModel.DesignMode.DesignModeEnabled returns true when called from user code running inside any version of the XAML designer--regardless of which SDK version you target. This check is recommended for most users.
Starting with the Windows 10 Fall Creators Update, Visual Studio provides a new XAML designer that targets the Windows 10 Fall Creators Update and later.
Use Windows.ApplicationModel.DesignMode.DesignMode2Enabled to differentiate code that depends on functionality only enabled for a XAML designer that targets the Windows 10 Fall Creators Update SDK or later.
The following table lists differences in functionality supported by the XAML designer, depending on the version of the Windows 10 SDK that the XAML designer targets.
| XAML designer that targets the Windows 10 Creators Update SDK or earlier | Xaml designer that targets the Windows 10 Fall Creators Update SDK or later | |
|---|---|---|
| CoreWindow | ❌ | ✔️ |
| CoreDispatcher | ❌ | ✔️ |
| Threading model | Single-threaded apartment (STA) | Application single-threaded apartment (ASTA) |
| .NET Framework | Desktop | Core |
| UI Composition support | ❌ | ✔️ |
| Acrylic brush support | ❌ | ✔️ |
| Fluent design system | Limited | Full support |
- See Also
DesignModeEnabled DesignModeEnabled DesignModeEnabled DesignModeEnabled
Gets a value that indicates whether the process is running in design mode.
public : static PlatForm::Boolean DesignModeEnabled { get; }public static bool DesignModeEnabled { get; }Public Static ReadOnly Property DesignModeEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
True if the process is running in design mode; otherwise false.
Remarks
Use this property when your custom types require special logic when running in a visual designer. For example, you can query this property to determine whether to display placeholder data instead of live data from a web service.
Note
The DesignModeEnabled property is available only in the presence of a developer certificate.
- See Also