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

How to get the listviewitem when clicking on its checkbox with Binding.twoWay in subModelSeq? #608

Closed
awaynemd opened this issue Jun 7, 2024 · 1 comment

Comments

@awaynemd
Copy link

awaynemd commented Jun 7, 2024

In the below code, I have a checkbox in the datatemplate of listview items. The checkbox is bound to "fPrint". I can select the listviewitem proper with "SelectedNewPrescription".

The problem I have is that I would like clicking on the checkbox to set the FPrint property on its listviewitem, but selecting the listviewitem should not set the FPrint property. (That is I can't bind the checkbox to the IsSelected event of the listviewitem in the xaml).

Looking at the specs on Binding.twoWay in the Submodelseq, I get the impression that the "click" and the item on which the click occurs is available to the setter--but I am unable to access it with SetFPrint.

Suggestions?

Thanks for any help.

"NewPrescriptions" |> Binding.subModelSeq(
(fun m -> m.NewPrescriptions),
(fun e -> e.rid),
(fun () -> [
"Medname" |> Binding.oneWay (fun (,e) -> e.Medname)
"Sig" |> Binding.oneWay (fun (
,e) -> e.Sig)
"Disp" |> Binding.oneWay (fun (,e) -> e.Disp)
"Form" |> Binding.oneWay (fun (
,e) -> e.Form)
"Refills" |> Binding.oneWay (fun (,e) -> e.Refills)
"fPrint" |> Binding.twoWay ((fun (
,e:Rx) -> e.fprint), SetFPrint )
])
)
"SelectedNewPrescription" |> Binding.subModelSelectedItem("NewPrescriptions", (fun m -> m.SelectedNewPrescription), SelectedNewPrescriptionMsg)

@awaynemd
Copy link
Author

After many hours of research, I find this question can easily be solved by using the CORRECT Binding.subModelSeq override.

Sleep really does help.

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

1 participant