Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elmish.Avalonia #554

Open
JordanMarr opened this issue Feb 10, 2023 · 2 comments
Open

Elmish.Avalonia #554

JordanMarr opened this issue Feb 10, 2023 · 2 comments

Comments

@JordanMarr
Copy link
Contributor

High-level description
I have created an "Elmish.Avalonia" branch that ports Elmish.WPF to work with Avalonia.

It seems to work nicely so far!
I'm assuming that it should live in this repository, but I guess that's what I am asking. Thoughts?
(@TysonMN, I already know you are currently busy this week, so no need to rush. I'm hoping others will weigh in as well.)

Cross referenced threads include:

Benefits
Avalonia.FuncUI already exists (I am a maintainer there) and is fantastic. So then why make an Elmish.Avalonia port?

  • Some people may prefer using xaml (and it can be an easier sell for some teams)
  • Bindings have to be created for controls. Some controls (such as the DataGrid) are too "OOP" and are difficult or impossible to create bindings for. This makes a library like Elmish.Avalonia very useful.
  • There is not currently a reliable design preview tool (there is a very experimental project, but the author has stopped working on it and it's way too complex for me to want to mess with it). For me to do any kind of real project work with Avalonia and F#, I feel that a design preview is a necessity. After recently trying Elmish.WPF, I fell in love with the designVM preview functionality.

Other reasons:

  • Avalonia UI is about to make a big announcement within the next week, so it's always nice for F# community to be able to participate in the latest and greatest with as many options as possible.
  • Avalonia already provides templating to create an F# MVVM solution that includes creating .axaml views within the same project!
  • The "Avalonia UI for Visual Studio 2022" extension provides a xaml preview pane that works with F#! 😄
  • The Elmish.WPF "designVM" concept works with this extension very well 😄
  • Keeping with tradition that the F# community will provide important libraries, developer tools and workload support.
@marner2
Copy link
Collaborator

marner2 commented Feb 11, 2023

Just thought I'd drop this in here, I've been working on an update that allows for bindings to be specified as static view model types rather than list of string bindings (tracking in issue #494 - I need to update it). This allows the WPF previewer tool to autocomplete bindings in the Design UI, as well as some other advantages (explicit types for Data Templates, etc).

I'm curious if this also affects Avalonia's tooling.

@JordanMarr
Copy link
Contributor Author

Avalonia supports that out of the box, but you can also implement their IPropertyAccessorPlugin interface to handle other binding strategies as I have done here:
https://github.com/JordanMarr/Elmish.WPF/blob/elmish-avalonia/src/Elmish.Avalonia/AvaloniaPropertyAccessorPlugin.fs

So, I believe it could definitely be modified to use your new strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants