In Windows Forms application, we can use Control.IsInDesignMode or LicenseManager.UsageMode == LicenseUsageMode.Designtime to check whether your code is executing in DesignMode or not. You might wonder how would you do the same in WPF. Fortunately, Cider and Blend offers a similar functionality. You can test the following condition DesignerProperties.GetIsInDesignMode(new DependencyObject()).
http://geekswithblogs.net/mrnat/archive/2007/09/16/115407.aspx
大致意思是说 LicenseManager.UsageMode == LicenseUsageMode.Designtime 这个东东,在WPF下是没办法判断的
要用这个来判断 DesignerProperties.GetIsInDesignMode(new DependencyObject())
请发表评论