tags:

views:

42

answers:

0

I am a newbie to WPF and MVVM light so hopefully someone can help point me in the right direction. I have a UserControl "Test" and the DataContext is set to the correct ViewModel "TestViewModel"

The issue I am having is when I place the control in the MainWindow.XAML I can not reference any of the public properties exposed in the ViewModel, I can only reference the public properties exposed in the View.

For instance:
In the View I have a public property Prop1

public int Prop1 { get; set; }

In the MainWindow.XAML the following works fine
<views:Test Prop1="0" />

In the ViewModel I have a public property Prop2

public int Prop2 { get; set; }

In the MainWindow.XAML the following does not work
<views:Test Prop2="1" />

I understand why BUT I don't know how to expose Prop2 so it can be set via XAML.

Any help would be appreciated.