I have a XAML Windows class
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:ObjectReferenceSample"
Title="ObjectReference Sample" Height="300" Width="300">
<Window.DataContext>
<ObjectDataProvider ObjectType="viewModel:MyViewModel">
<ObjectDataProvider.ConstructorParameters>
**<!-- MyModel class instance defined in codebehind-->****
</ObjectDataProvider.ConstructorParameters>
</ObjectDataProvider>
</Window.DataContext>
</Window>
Also in my code behind I have an instance of MyModel class that needs to be passed as constructor parameter to my ViewModel through ObjectDataProvider.
public partial class MyWindow: Window
{
public MyModel model;
public MyWindow()
{
model = new MyModel();
}
}
MyViewModel would like:
public partial class MyViewModel
{
public MyViewModel(MyModel modelInstance)
{
}
}
I have some limitation of not being able to use DI like Unity. Please suggest me solution of above problem without DI concept only.