Elmish.WPF icon indicating copy to clipboard operation
Elmish.WPF copied to clipboard

v4: Static View Models

Open marner2 opened this issue 2 years ago • 0 comments

Here is a summary of the "Static View Models" feature being added to v4.

  • [x] Split apart BindingData and DynamicViewModel/Binding concepts
    • [x] #449
    • [x] #450
    • [x] #467
    • [x] #468
    • [x] #469
    • [x] #472
    • [x] #474
    • [x] #484
  • [x] Make so that types are more variant (use get/set instead of ref/mutable types)
    • [x] #454
    • [x] #459
    • [x] #475
  • [ ] Group related functionality more closely together
    • [x] #451
    • [x] #453
    • [x] #460
    • [x] #461
    • [x] #495
    • [x] #497
    • [x] #498
    • [ ] #489
    • [ ] #506
  • [ ] Add typed 'vm argument to BindingData so that the property can be statically typed
    • [x] #464
    • [x] #505
    • [x] #504
    • [x] #470
    • [ ] #512
    • [ ] #511
    • [ ] #513
    • [ ] #508
  • [ ] Implement ability to make an elmish view model type with statically-typed properties
    • [ ] #496
    • [ ] #507

There are fundamentally two parts to this push. The first is to allow statically-defined view model types to work with Elmish, and the second is to allow the properties of those view model types to be statically typed.

From a discussion with @TysonMN about the advantages of statically typed properties:

When used in the context of "dot" notation in the XAML project, you will be able to get compile-time help for things like ViewModelProp.SubModel.Prop. If those were constrained to obj, you wouldn't get compile-time checking of those types. Also XAML will warn you about type issues (number vs string, etc)

In addition, allowing statically-defined view model types will enable users to call out these view model types by name. This will allow things like data templates with explicit DataTypes set.

marner2 avatar Jun 27 '22 19:06 marner2