Reputation: 664
I have 2 views (first view - custom user control, MainWindow view - main view with first custom control as a child).
First view has TreeView and DependencyProperty SelectedModel which changes when user change selection in TreeView. Main window view also has label with binding to SelectedModel property of MainWindowModel.
Label doesnt updates.
Upvotes: 1
Views: 248
Reputation: 39006
I think by setting the DataContext
of your FirstView
, it breaks the data inheritance so your FirstView
won't have access to the data (i.e. SelectedModel
) defined in your main viewmodel.
Try commenting out
public FirstView()
{
InitializeComponent();
//this.DataContext = _viewModel;
}
and see if it works.
Upvotes: 2