Support for plugin architecture in Elmish.WPF app?

91 Views Asked by At

I know how to do this:

  • Find and load plugin assemblies at runtime.
  • Instantiate instances of plugins, including XAML-based views.
  • Place the XAML-based view on the screen.

I think I can even update msg model from my application's update to the plugins' updates.

What I'm missing is how to connect my runtime-instantiated plugins into the Elmish.WPF bindings.

I am currently calling the following in main, of course:

Program.mkProgram MainWindow.init MainWindow.update MainWindow.bindings
|> Program.runWindow (MainWindowView())

My MainWindow.init is creating a separate thread that successfully initializes the views and adds them to the display.

How do I add new bindings at runtime?

1

There are 1 best solutions below

0
On BEST ANSWER

How do I add new bindings at runtime [in Elmish.WPF]?

I don't think this is possible. Elmish.WPF could be more accurately called Elmish.WPF.Static to emphasize that it is only designed to work with "static" views, i.e. XAML files that exist at compile time. In contrast, the maintainer of Elmish.WPF[.Static] has also tried to get a dynamic WPF Elmish-based solution working under the name Elmish.WPF.Dynamic. I would be interested to know if this helps you solve your problem.