Hi,
I have been looking around and haven't found much information on this yet. I have a PRISM project set up and it all seems to be working so far, within the main class of a module I am programatically creating my views.
What I am trying to do is get an object sent through to the viewmodel for each instance of the view. At the moment I am trying to pass the object into the views constructor and do something like this:
public MyView(IUnityContainer container, List<string> myDataObject)
{
InitializeComponent();
MyViewViewModel vm = LayoutRoot.DataContext as MyViewViewModel;
vm.DataObject = myDataObject;
}
This causes a NullReferenceObject for vm.DataObject, I assume the viewmodel hasn't been properly instantiated at this point.
Can anyone guide me on how this should be done? should the data object even be send via the view?
Thanks for your time