(X) Hide this
    • Login
    • Join
      • Say No Bots Generate New Image
        By clicking 'Register' you accept the terms of use .
        Login with Facebook

Is in design Mode?

(0 votes)
1 comments   /   posted by Ivan Dragoev on Feb 27, 2009
Tags:   design-mode , control-mode , c# , david-anson , visual-studio , expression-blend

Detecting whether the control is in design mode in both - Blend and Visual studio is an interesting task. Check Delay's post showing how for sure to detect the control mode.

Unfortunately, the official mechanism for this, DesignerProperties.GetIsInDesignMode, doesn't always return the correct value under Visual Studio. :(

Well, I needed something reliable for the Charting assembly in the Silverlight Toolkit, so I checked with the experts (i.e., members of both teams) and came up with the following code that returns the correct value under both Blend and Visual studio (from DesignerProperties.cs in the Silverlight Toolkit source).


Comments

  • -_-

    RE: Is in design Mode?


    posted by Eugene on Mar 05, 2009 23:48

    Hi

    just want to let you know, that this trick doesn't work correctly when hosting a WPF control in WinForms project. It always returns true saying that WPF control is in design mode even when the application runs.

    Do you know a solution for this?

    Thx

Add Comment

Login to comment:
  *      *       
Login with Facebook

Our News on Twitter