• 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/MTg2

Related Code
Strongly typed NotifyPropertyChanged
IsInDesignMode for Silverlight
Fork of Strongly typed NotifyPropertyChanged

IsInDesignMode for WPF and Silverlight

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

2
1.03k 0 1 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 SL and WPF inside Blend and Visual Studio.
    /// </summary>
    public static bool IsInDesignMode
    {
        get
        {
            if (_isInDesignMode == null)
            {
                string app = Application.Current.ToString();
                if (app == "System.Windows.Application" || app == "Microsoft.Expression.Blend.BlendApplication")
                {
                    _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'

wpf

Mark 'wpf' tag as 'like'

Mark 'wpf' tag as 'ignore'


 @sondreb "Code Contributor"
409
July 13, 2010 10:45 AM

Fork

  IsInDesignMode for WPF and Silverlight -  @sondreb Tuesday 13, 2010 10:45 AM


1 Feedback

Great! -  @fredrikn Tuesday 13, 2010 1:11 PM

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