Can a DataTemplate be a Page?
- by dthrasher
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?