bradphelan / FUNCUI.Samples

FUNCUI.Samples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XTargets.Elmish.Lens

A working demo for using a lens with the FuncUI Elmish API for Avalonia rather than the classic elmish messages and commands.

May also work with other Elmish consumers such as Fable?? There is no dependency directly on FUNCUI.

https://github.com/bradphelan/FUNCUI.Samples

image

It's a master child editor setup. The data model is

Application has_many  Companies
Company has_many Employees

The view on the left allows you to select a company. The view on the right allows you to edit the company name and product and also edit ( but not yet add or remove employees )

Troubles I had.

  • TextBox.OnTextChanged is a PITA. Because it fires when the model is first loaded without user input it often triggers the dispatch loop to keep firing forever. This might have been to due to other bugs I had but OnTextChanged is evil. I now listen specifically for keypresses to ensure that an update is user fired rather that UI fired.

  • ListBoxes combined with editable TextBoxes don't really work. The list row is not selected as the EditBox doesn't bubble the tap event back to the ListBox. I fought this for a while and gave up. The UI kind of works around the problem. Notice I don't allow editing of company data in the left hand list view as I need the row selection to work but in the right hand view I do allow it for employees because I don't care about the selection.

2020-03-20_19-56-11

You should be able to build the app with just

dotnet build
dotnet run

About

FUNCUI.Samples

License:MIT License


Languages

Language:F# 98.8%Language:PowerShell 1.2%Language:Forth 0.0%