uno.extensions
uno.extensions copied to clipboard
[MVUX / Navigation] Update ViewModelMappings
What would you like to be added:
Improve the way ViewModelMappings
is being generated.
Why is this needed:
- We are generating them in the "assembly name" namespace,
- This can be confusing
- When generating it from the head project, it forces user to use
#pragma
code
- There is no way to easily merge mappings from multiple projects
- Users have to explicitly reference generated code
Proposed solution
Following the KeyPropety
generator, we can generate some internal types that will register mappings to a static registry using [ModuleInitializer]
attribute.
For which Platform:
- [x] iOS
- [x] Android
- [x] WebAssembly
- [x] WebAssembly renders for Xamarin.Forms
- [x] Windows
- [ ] Build tasks
@dr1rrb is work still required on this?
Question: will this issue fix also resolve below (found today in latest stable Uno 5 with Uno.Extensions.*
3.0.11)?
Page datacontext is set to
TModel
instead of bindable viewmodel afterNavigateViewModelAsync<TModel>()
whenTModel
is not defined in the same assembly as where it was registered in views/routesWorkaround: register bindable model instead of model in app views and routes (as indicated in point 3 in the issue description)
If not, I will register a separate issue
Hey @VincentH-Net, yes the issue you have refers to the point 2 (which leads you to point 3 :) ).
And yes @nickrandolph the issue is still relevant :)
@dr1rrb, @nickrandolph I imagine this issue is still relevant?