XTargets.Elmish.Lens 0.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package XTargets.Elmish.Lens --version 0.0.6
NuGet\Install-Package XTargets.Elmish.Lens -Version 0.0.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XTargets.Elmish.Lens" Version="0.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XTargets.Elmish.Lens --version 0.0.6
#r "nuget: XTargets.Elmish.Lens, 0.0.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XTargets.Elmish.Lens as a Cake Addin
#addin nuget:?package=XTargets.Elmish.Lens&version=0.0.6

// Install XTargets.Elmish.Lens as a Cake Tool
#tool nuget:?package=XTargets.Elmish.Lens&version=0.0.6

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
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 is compatible.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on XTargets.Elmish.Lens:

Package Downloads
XTargets.FuncUI

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.7 600 4/2/2020
0.0.6 530 3/24/2020
0.0.5 423 3/24/2020
0.0.4 454 3/24/2020
0.0.3 439 3/24/2020
0.0.2 437 3/24/2020
0.0.1 449 3/21/2020