I have a generic class
public abstract class BaseViewModel<T>
Since I am trying to create a DataTemplate that will be applied to all classes that derive from BaseViewModel, I set the type to BaseViewModel:
<DataTemplate DataType="{x:Type vm:BaseViewModel}">
However, this does not work since it looks like xaml does not support generic data types.
Are there any work arounds to this?
I would create a non-generic version of
BaseViewModel
and let the generic one inherit from it:By doing this, your
DataTemplate
is going to work.