Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Designer DataTemplate.DataType cannot be type object

Tags:

c#

wpf

designer

I think it wants you to use an interface type instead of a class type.

So, if you define an interface ICorrectionAndFreqViewModel that exposes all of the properties that you'll be using for data binding and then have CorrectionAndFreqViewModel implement that interface, you should be good.

Like you said, the code will still compile and run without using an interface here. My guess as to why the designer complains about this is that data binding can only be used on public properties, so by using an interface, there's a guarantee that all the properties will be public.


I was able to fix this by making sure the file name is exactly as the class name.