Monday, April 19, 2010

WPF Problem Loading Designer

If your designer view is having problem loading, its probably because you have some code-behind in the constructor of your xaml form or user control. Add the following;

if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
     // Code which causes the designer to fail
     // Stick this using segment inside the contructor 
     // code-behind and encapsulate all extra code
     // You may also need to add it to any initialize
     // or form load method if you have added extra code