+ 1
mvvm How to pass usercontrol from viewmodel to view
I have a class library that i am using in my viewmodel. For normal data (bool, int , string). This works fine. This class-library also contains a user control. I like to show this user-control in my main application. How can I create something in my viewmodel that allows me to refer to in my mainview
4 Réponses
+ 3
Use LiveData class inside viewmodel and observ that livedata in you activity or fragment
+ 3
You mean you have class called library and you want to access that class inside your activity or fragment if yes than it possiable to observe this library class inside activity you just need one livedata that Contain library class as a genric parameter and after that you need to observe that livedata in your activity or fragment.
+ 1
Are you saying that you only can share data via a viewmodel.
That is fine as long if you have one view and one viewmodel.
I have a class-library with a usercontrol. I want to control, the way it behave and how it looks in de class library as independent self-controlled piece of UI. Is this possible with live data ?
Do you have a link to a tutorial I like to read more about it.
0
Is livedata just for android or also for wpf/windows desktop ?