Why I receive such message?
Attribute ‘Dependency’ is not valid on this declaration type. It is only valid on ‘assembly’ declarations.
public partial class MainWindow : Window
{
private OverviewViewModel _vm;
[Dependency]
public OverviewViewModel VM
{
set
{
_vm = value;
this.DataContext = _vm;
}
}
You are probably using the wrong attribute: DependencyAttribute
and can only be applied to assemblies (and not to properties like you are trying), e.g.: