• Code
  • Tags
  • Users
  • Titles
  • Log in
  • Feedback
  • FAQ
Share Code
Welcome to ForkCan.com

ForkCan is all about sharing code in a social way.

Discuss, debate or argue with other devs about their or your own code.

Give other devs feedback or make a Fork (Make a better version of a shared code).

Rate the code, if you use the code mark it as used so others can see if the shared code is used by someone.

Help each other to be better devs and to be more productive.


Features not working yet:

Flag a post


QR Code

Tiny Url

http://4kcan.com/s/MTc5

Related Code
IsInDesignMode for WPF and Silverlight

IsInDesignMode for Silverlight

Here is the proper way to check for IsInDesignMode for Silverlight which works for both Blend and Visual Studio.

2
483 0 0 0 0 0

public class Bootstrapper
{
    private static bool? _isInDesignMode = null;

    /// <summary>
    /// Returns a boolean value whether the code is currently running in design-mode.
    /// This check works for both Blend and Visual Studio. 
    /// DesignerProperties.GetIsInDesignMode() that many uses only works in Blend.
    /// </summary>
    public static bool IsInDesignMode
    {
        get
        {
            if (_isInDesignMode == null)
            {
                // At design-time, Application.Current is "Application".
                if (Application.Current.GetType() == typeof(System.Windows.Application))
                {
                    _isInDesignMode = true;
                }
                else
                {
                    _isInDesignMode = false;
                }
            }

            return _isInDesignMode.Value;
        }
    }
}

Share: twitter | facebook   Action: used | fork | flag

designmode

Mark 'designmode' tag as 'like'

Mark 'designmode' tag as 'ignore'

silverlight

Mark 'silverlight' tag as 'like'

Mark 'silverlight' tag as 'ignore'


 @sondreb "Code Contributor"
409
July 12, 2010 10:40 PM
edited July 12, 2010 10:44 PM

Fork

 IsInDesignMode for Silverlight -  @sondreb Monday 12, 2010 10:40 PM


0 Feedback


You must log in before you can give any feedback


0 Discussion(s)

Newest Oldest

You must log in before you can post a comment

Squeed
Made by: Fredrik Normén 2010