This repository was archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Enhancement] Add API for programmatically checking if running in design mode #1731
Labels
Comments
the implications are far from "easy" |
@StephaneDelcroix Can you elaborate? I've been told that this "should be easy" so I was repeating that. I'd be curious to know further details in either direction. |
therealjohn
added a commit
to therealjohn/Xamarin.Forms
that referenced
this issue
Feb 8, 2018
Provides a static boolean that can be checked by application authors whether their app is running in a tool considered to be a designer or previewer. Tool authors can set this value to true whenever the app is running in that context or not. Resolves xamarin#1731
therealjohn
added a commit
to therealjohn/Xamarin.Forms
that referenced
this issue
Feb 8, 2018
Provides a static boolean that can be checked by application authors whether their app is running in a tool considered to be a designer or previewer. Tool authors can set this value to true whenever the app is running in that context or not. Resolves xamarin#1731
therealjohn
added a commit
to therealjohn/Xamarin.Forms
that referenced
this issue
Feb 8, 2018
Provides a static boolean for application authors to check if their app is running in a visual designer or previewer. Tools can set this value when running the app in a designer or previewer context. Resolves xamarin#1731
4 tasks
I started this in #1844. The intent of this F100 issue was just for programmatic checks and did not cover things like |
therealjohn
added a commit
to therealjohn/Xamarin.Forms
that referenced
this issue
Feb 21, 2018
Provides a static boolean for application authors to check if their app is running in a visual designer or previewer. Tools can set this value when running the app in a designer or previewer context. Resolves xamarin#1731
therealjohn
pushed a commit
to therealjohn/Xamarin.Forms
that referenced
this issue
Feb 23, 2018
* Adds DesignMode class Provides a static boolean for application authors to check if their app is running in a visual designer or previewer. Tools can set this value when running the app in a designer or previewer context. Resolves xamarin#1731 * Enable design mode when we use the design mode APIs These are the two supported APIs for design mode rendering, so to ensure the DesignMode boolean is set correctly for all existing releases of VS/VSMac, let's set it to true whenever something connects to the design mode rendering APIs.
alanmcgovern
added a commit
that referenced
this issue
Feb 23, 2018
* Adds DesignMode class Provides a static boolean for application authors to check if their app is running in a visual designer or previewer. Tools can set this value when running the app in a designer or previewer context. Resolves #1731 * Enable design mode when we use the design mode APIs These are the two supported APIs for design mode rendering, so to ensure the DesignMode boolean is set correctly for all existing releases of VS/VSMac, let's set it to true whenever something connects to the design mode rendering APIs.
therealjohn
pushed a commit
to therealjohn/Xamarin.Forms
that referenced
this issue
Feb 23, 2018
* Adds DesignMode class Provides a static boolean for application authors to check if their app is running in a visual designer or previewer. Tools can set this value when running the app in a designer or previewer context. Resolves xamarin#1731 * Enable design mode when we use the design mode APIs These are the two supported APIs for design mode rendering, so to ensure the DesignMode boolean is set correctly for all existing releases of VS/VSMac, let's set it to true whenever something connects to the design mode rendering APIs.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Rationale
User’s desire a way to specify code that should only run when their code is running in a designer context such as Previewer or Live Player.
Implementation
The property should be considered to have a public setter so that third-party tools can also mark this as true when they would prefer to. i.e. LiveXaml, GorillaPlayer, etc. may want to set this to true so users can do something special in those contexts. Or, perhaps it's better to make this read only and make some static method for enabling it. i.e.
Xamarin.Forms.DesignMode.EnableDesignMode()
See UWP documentation.
Expected Result
DesignModeEnabled
would returntrue
when code is running in a preview or design-time tool. Otherwise, false.Android
Nothing specific for Android.
iOS
Nothing specific for iOS.
UWP
Nothing specific for UWP
Implications for CSS
None that I am aware of.
Backward Compatibility
Uncertain, but it seems a new API like this would have little to no backwards compatibility issues.
Difficulty: Easy
There may be some additional coordination required with the designer team for a few additions for the previewer to work with this. Otherwise, it should be simple to implement.
The text was updated successfully, but these errors were encountered: