WPF Designer "Could not create an instance of type"

jchadhowell picture jchadhowell · May 14, 2009 · Viewed 24.5k times · Source

In my UI XAML I'm essentially inheriting from a class "BaseView" that contains functionality common to several forms, however this is preventing the designer from displaying the form: "Could not create instance of type BaseView". The code will compile and run, but it is frustrating not to be able to see the form in the Designer. Is there a better way? Thanks.

XAML:

<vw:BaseView 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vw="clr-namespace:ReviewClient"   
    x:Class="ReviewClient.MainPage"

...

Answer

jchadhowell picture jchadhowell · May 18, 2009

The problem was that the base class was defined as abstract. This caused the designer to fail. This problem is described in more detail in the comments section of Laurent Bugnion's blog: http://geekswithblogs.net/lbugnion/archive/2007/03/02/107747.aspx