Elmish.WPF
Elmish.WPF copied to clipboard
[Samples] Raising events from program to UI
Doing Elmish.Uno development we came to a need of raising an event that must be handled on UI (display iOS printer picker)
The approach is to create a class that holds all the events. That class instance is returned via binding but event sources that can be triggered are located in an Elmish program.
type EventsHolder (pickPrinterEvent) =
[<CLIEvent>] member _.PickPrinter = pickPrinterEvent.Publish
let pickPrinterEvent = Event<,>
"Events" |> Binding.oneWay (fun m -> m.Events)
On UI EventTrigger
is used to subscribe
I solved a problem in my application at work by passing a FrameworkElement
to the F# code and then using it to create an Elmish Cmd
.
I wonder if this is relevant here.
Can you link to sample code that shows this functionality in action?