0

In a WPF project we are using the MVVM pattern with EDM. I have a screen with one button name as template and a ComboBox. When I click on the template button, it will open a popup screen and select a template from a TreeView. I want the selected child node to be bound to the original ComboBox.

How to do? I am new to MVVM. Can any one guide in that?

Gert Arnold
  • 105,341
  • 31
  • 202
  • 291
user768853
  • 269
  • 1
  • 4
  • 16

1 Answers1

0

Normally you shouldn't bind elements across multiple views. You can bind multiple Views to a single ViewModel.

So what you could do is add a property called SelectedTemplate to the ViewModel and bind the SelectedItem of the TreeView to this property. This way you will always know what Template was selected.

In the other View you can bind the SelectedItem of the ComboBox to the SelectedTemplate property of the ViewModel.

Emond
  • 50,210
  • 11
  • 84
  • 115