Failed to assign to property 'Microsoft.Practices.Prism.Mvvm.ViewModelLocator.AutoWireViewModel'

Topics: Prism v2 - WPF 3.5, Prism v2 - WPF 4, Prism v4 - WPF 4
Nov 30, 2014 at 5:21 AM

I'm working on a Windows 8.1 Universal app using Prism & Unity.

I have a Page which contains a user control. Both have their own their View Models and both are wired up to auto locate using the AutoWireViewModel attached property , and the page VM is locating fine, but the user control fails on InitializeComponent() with

Failed to assign to property 'Microsoft.Practices.Prism.Mvvm.ViewModelLocator.AutoWireViewModel'

(Actually the pop up error says "Failed to assign to property '0%'")

If I remove the AutoWireViewModel line from the xaml it works fine, but bindings fail due to not having the VM of course.

This works fine in the Windows 8.1 version but fails in the Windows Phone 8.1 version, using exactly the same code.

I have no idea what to try next?

Nov 30, 2014 at 3:04 PM
I guess one of the things I could try is to specify my UserControl base class in the xaml (which implements IView) as opposed to a standard User Control (which doesn't)

Sorry if I wasted anyone else's time.
Marked as answer by Russty on 11/30/2014 at 8:52 AM