Recommended

More from Ivan Dragoev

  • Saving Snapshots to PNG in Silverlight 4 and the WebCam
  • Silverlight Hosting in WPF
  • Silverlight 4 – WebCams.OnceMoreWithAudio()
  • Drawing Farseer Physics Vertices and Body Center in Silverlight
  • WCF RIA Services – Dynamically Create a Criteria on the Client-side
Skip Navigation LinksHome / News / View News

Is in design Mode?

+ Add to SilverlightShow Favorites
1 comments   /   posted by Ivan Dragoev on Feb 27, 2009
(0 votes)
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).

Share


Comments

Comments RSS RSS
  • 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

 
 

   
  
  
   
Please add 5 and 4 and type the answer here:

Help us make SilverlightShow even better. Whether you'd like to suggest a change in the structure, content organization, section layout or any other aspect of SilverlightShow appearance - we'd love to hear from you! Need material (article, tutorial, or other) on a specific topic? Let us know and SilverlightShow content authors will work to have that prepared for you. (hide this)