0

WPF newb here. Consider the following situation

  • Parent user control A
  • Parent control has a placeholder / slot that these MEF extension User control can be loaded into dynamically.
  • All MEF extensions that provide a User control implement a specific interface. This includes a boolean that they can set to indicate an operation is complete.
  • Parent A has a button that needs to be enabled when the specific property(mentioned in the point above) is set to true.

Is this possible? If yes , how?

Is binding + INotifyPropertyChanged the way to go?

We've also thought of passing in Actions that can be used to update the state of the parent.

Are there any other alternatives?

Ashwin
  • 1,190
  • 2
  • 10
  • 30
  • Take a look at event aggregator pattern, also look at this question https://stackoverflow.com/q/30459296/1462656 – erotavlas Mar 14 '19 at 03:04

1 Answers1

0

So let me explain;

  1. if dynamically loaded user control has no data context (no view model is set), then user control uses view model of parent.
  2. But if you define a view model for each user control, you can import these view models and manage them in parent view model.
  3. Consider also using a BaseViewModel (BindableBase for MEF)
Ugur
  • 1,257
  • 2
  • 20
  • 30