How to Disable Design Time Execution of a Custom Dependency Property?

Implementing a custom Dependency Property on a Framework Element object causes my Visual Studio WPF designer to crash. The designer appears to be executing my Dependency Property code upon load of the designer. Consequently, the designer finds an unhandled exception (that I have thrown in the Dependency Property code myself) and breaks.

Is there any way to disable Design-Time execution of my custom Dependency Property so my designer still works?

Answers


You should be able to check the IsInDesignMode property of the DependencyObject and choose to not throw the exception.


Need Your Help

Best way to put vectorized symbols on button? Wingdings button title

android button icons vector-graphics wingdings

Suppose I want to draw simple icon on the button surface. Let it be the cross or some letter.

HttpRequestValidationexception on Asp.Net MVC

asp.net asp.net-mvc-3

I’m getting an HttpRequestValidationexception with this error message: