In order to detect whether your application is executing as a result of being in a designer use the GetIsInDesignMode method of DesignerProperties as the following demonstrate.
C#
bool designTime = System.ComponentModel.DesignerProperties.GetIsInDesignMode(
new DependencyObject());
VB.NET
dim designTime as Boolean = DesignerProperties.GetIsInDesignMode(
New DependencyObject)
Daniel Vaughan is a Microsoft MVP and cofounder of
Outcoder, a Swiss software and consulting company dedicated to creating best-of-breed user experiences and leading-edge back-end solutions, using the Microsoft stack of technologies--in particular Silverlight, WPF, WinRT, and Windows Phone.
Daniel is the author of Windows Phone 7.5 Unleashed, the first comprehensive, start-to-finish developer's guide to Microsoft's Windows Phone 7.5.
Daniel is also the creator of a number of open-source projects, including
Calcium SDK, and
Clog.
Would you like Daniel to bring value to your organisation?
Please contact
Daniel's Blog |
MVP profile |
Follow on Twitter
Windows Phone Experts