Silverlight Feeds - All your Silverlight feeds in one place.

Sponsors

Wednesday, September 02, 2009

How to detect design mode in WPF/Silverlight

by Corrado Cavalli via Corrado's BLogs on 9/2/2009 7:14:44 PM

Nella lista dei WPF Disciples si è discusso di come determinare in maniera corretta la modalità Design Mode, ovvero quando il codice sta girando nel contesto di un desginer.

Le risposte sono:

WPF

   1: public static class Designer
   2: {
   3:    private static readonly bool isDesignMode;
   4:  
   5:    public static bool IsDesignMode {get { return isDesignMode; }}
   6:  
   7:    static Designer()
   8:    {
   9:       DependencyProperty prop = DesignerProperties.IsInDesignModeProperty;
  10:       isDesignMode = (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement))
  11:                                                        .Metadata.DefaultValue;
  12:    }
  13: }

Silverlight 3

   1: bool onDesignMode = DesignerProperties.IsInDesignTool;

Technorati Tags: ,,
email it!bookmark it!digg it!

Original Post: How to detect design mode in WPF/Silverlight

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us