Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving from WPF 3.5 to 4.0 causes error "Can't put a page in a Style"

Tags:

mvvm

wpf

I'm in the process of moving my application from .NET 3.5 to .NET 4.0, and I get the following error message : "Can't put a page in a Style". I've implemented the MVVM pattern for this application and use Data Templates to tell the application how to render my various view models...for example below.

<DataTemplate DataType="{x:Type vm:ConfigureAxViewModel}">
    <vw:ConfigureAxPage />
</DataTemplate>

Is there any way around this error? Do I have to make my pages controls?

Thanks, Roy

like image 336
LPCRoy Avatar asked Nov 14 '22 14:11

LPCRoy


1 Answers

Docs for both 3.5 & 4.0:

A page can be hosted from Window, NavigationWindow, Frame, or from a browser.

I would not expect a view that is a page to work in many instances for that matter, usually views are just UserControls. Though i also would not expect that error message...

like image 178
H.B. Avatar answered Dec 23 '22 07:12

H.B.