forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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.
- Loading branch information
1 parent
ff40c5b
commit 8f8f31e
Showing
7 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using NUnit; | ||
using NUnit.Framework; | ||
|
||
namespace Xamarin.Forms.Core.UnitTests | ||
{ | ||
public class DesignModeTests : BaseTestFixture | ||
{ | ||
[Test] | ||
public void DesignModeEnabledIsFalseByDefault() | ||
{ | ||
Assert.IsFalse(DesignMode.DesignModeEnabled); | ||
} | ||
|
||
[Test] | ||
public void DesignModeEnabledIsTrueWhenSet() | ||
{ | ||
DesignMode.DesignModeEnabled = true; | ||
|
||
Assert.IsTrue(DesignMode.DesignModeEnabled); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Xamarin.Forms | ||
{ | ||
public static class DesignMode | ||
{ | ||
public static bool DesignModeEnabled { get; internal set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Type Name="DesignMode" FullName="Xamarin.Forms.DesignMode"> | ||
<TypeSignature Language="C#" Value="public static class DesignMode" /> | ||
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit DesignMode extends System.Object" /> | ||
<AssemblyInfo> | ||
<AssemblyName>Xamarin.Forms.Core</AssemblyName> | ||
<AssemblyVersion>2.0.0.0</AssemblyVersion> | ||
</AssemblyInfo> | ||
<Base> | ||
<BaseTypeName>System.Object</BaseTypeName> | ||
</Base> | ||
<Interfaces /> | ||
<Docs> | ||
<summary>Enables you to detect whether your app is running in a visual designer or previewer.</summary> | ||
<remarks></remarks> | ||
</Docs> | ||
<Members> | ||
<Member MemberName="DesignModeEnabled"> | ||
<MemberSignature Language="C#" Value="public static bool DesignModeEnabled { get; }" /> | ||
<MemberSignature Language="ILAsm" Value=".property bool DesignModeEnabled" /> | ||
<MemberType>Property</MemberType> | ||
<AssemblyInfo> | ||
<AssemblyVersion>2.0.0.0</AssemblyVersion> | ||
</AssemblyInfo> | ||
<ReturnValue> | ||
<ReturnType>System.Boolean</ReturnType> | ||
</ReturnValue> | ||
<Docs> | ||
<summary>Gets a value that indicates whether the application is running in design or preview mode.</summary> | ||
<value></value> | ||
<remarks></remarks> | ||
</Docs> | ||
</Member> | ||
</Members> | ||
</Type> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters