2

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?

Wallace Kelly
  • 15,565
  • 8
  • 50
  • 71
  • I'm beginning to wonder if I need to instantiate my plugins (including getting their bindings) _before_ calling Program.mkProgram. Changes to plugins would require a restart. That would work, but it would be nice to be able to load plugins after startup. – Wallace Kelly Mar 19 '19 at 21:28

1 Answers1

1

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.

Tyson Williams
  • 1,630
  • 15
  • 35