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

[Bindings] TwoWaySeq #610

Open
xperiandri opened this issue Jul 27, 2024 · 9 comments
Open

[Bindings] TwoWaySeq #610

xperiandri opened this issue Jul 27, 2024 · 9 comments

Comments

@xperiandri
Copy link

High-level description
TokenizingTextBox from WCT modifies the collection supplied to ItemsSource. Hence changes must be propagated back to the model.

I've implemented TwoWaySeq binding in my fork
See commits in https://github.com/Ecierge/Elmish.Uno/commits/eCierge/

Backport if you consider it useful

@YkTru
Copy link

YkTru commented Jul 28, 2024

Doesnt 'NotifyCollectionChangedEventArgs' bind you to .Net? I mean, why can't notification be done with Msg + updates as usual?

@xperiandri
Copy link
Author

But the collection is being modified from the UI. So I need to know when it happened from UI

@YkTru
Copy link

YkTru commented Jul 28, 2024

I may be confused, so please correct me if I'm wrong, but my intuition is as follows:

1- if the library is to be linked to Net (which is inevitable for UNO/WPF), all Net functionality must be “hidden” (as in this file), i.e. the MVU part must not use anything from Net (with the exception of “Window” in “main”)

2- if I need to get data from the UI and “Mode=TwoWay” isn't enough, I use Behaviors to bind to events, or for any other scenarios (personnally, I use Behaviors a LOT to keep MVU independent and clean).

3- otherwise, I have an F# project called “[ProjectName].WPF.Fs” which depends on “[ProjectName].Core” (parallel to C# "[ProjectName].WPF") in which I do all my "WPF dependant" code; I used it recently to do some clean DataTemplateSelector code (for a Form Designer), and I think I'll do my behaviors in F# too (I really prefer the syntax + error handling).

Am I misunderstanding something? Is that the way to go @marner2?

@xperiandri
Copy link
Author

Well, I do not argue that the API may be better than I implemented.
The issue is that if an ObservableCollection is modified from UI you will never get such update. So we need to get it somehow

@YkTru
Copy link

YkTru commented Aug 27, 2024

@xperiandri Well, too bad our efforts to spark conversation aren't taken into account. I hope you'll continue to be interested in ElmishWPF/UNO and use it, otherwise I'll be very lonely..

Thank you for sharing your code and insights.

@xperiandri
Copy link
Author

Maybe you become a maintainer of this repo? @YkTru

@YkTru
Copy link

YkTru commented Aug 27, 2024

Haha! I was thinking more of you!

You clearly understand the ins and outs of this library better than I do. I've been using F# since last October, so I'm in danger of breaking it all!

@marner2
Copy link
Collaborator

marner2 commented Oct 1, 2024

So the issue here is to support hooking up a UI-supplied ObservableCollection of items? I'm pretty sure (at least WPF) XAML controls are not supposed to ever do that. What's the reasoning behind it?

@xperiandri
Copy link
Author

Yes. As I specified I found that on the TokenizingTextBox control

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

3 participants