Can a DataTemplate be a Page?

Posted by dthrasher on Stack Overflow See other posts from Stack Overflow or by dthrasher
Published on 2010-05-09T17:40:30Z Indexed on 2010/05/10 0:18 UTC
Read the original article Hit count: 315

Filed under:
|
|

I'm using the MVVM pattern to create a WPF standalone application. My program compiles in Visual Studio 2008, but I frequently get warnings in the editor for my DataTemplates.

In my MainWindow.xaml, I've defined the following DataTemplate:

    <DataTemplate DataType="{x:Type ViewModels:TagViewModel}">
        <Views:TagView />
    </DataTemplate>

Where "TagView" is derived from a Page, rather than an ordinary UserControl.

This causes the following message to appear every time I reload the designer in Visual Studio: "Could not create an instance of type 'TagView'. Yet the solution compiles fine and the program seems to work properly.

Is this a bug in the Visual Studio 2008 editor? Or am I doing something wrong?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about visual-studio-2008