TinyLittleMvvm
TinyLittleMvvm copied to clipboard
Binding views to view models
First of all thank you for this very useful library. Is it possible with TinyLittleMvvm to assign views to view models also dynamically in the start-up code, instead of doing it statically in the xaml file? Would be possible to assign different instances of the same view-model to different views? Is there any schedule available for the release of a stable v2?
Is it possible with TinyLittleMvvm to assign views to view models also dynamically in the start-up code, instead of doing it statically in the xaml file? Would be possible to assign different instances of the same view-model to different views?
There's no mapping in the XAML files. In fact, by default TinyLittleMvvm takes the full name of the view model, replaces ViewModel
with View
, and gets an instance from the DI container. E.g. for the view model MyApp.ViewModels.MyViewModel
, it will ask for an instance of MyApp.Views.MyView
.
You can customize it by changing ViewLocatorOptions
, but still it only allows a mapping from view model type to view type.
What's you actual use case? Maybe we can find a solution.
Is there any schedule available for the release of a stable v2?
Well, as far as the code is concerned, it's ready for shipment. But I want to update the documentation before publishing it, as the API has changed significantly between v1 and v2.
Thank you for the explanation. I dont have yet a concrete use case. I was trying to understand how the mapping between views and view models works in TinyLittleMvvm, and what possibilities does it offer to customize it if needed (maybe adding some sample code to your repository for such a scenario would help).
Yeah, documentation is on my list: #26