Open grill2010 opened 7 years ago
How do you load this component? I assume that you don't embedd it in other FXML files because in this case passing constructor arguments wouldn't be possible. So I assume that you create an instance of this view in Java code and put the instance into the scene-graph "by hand"?
Maybe you can pass the context object as constructor parameter too? However, this means that at the place where you create your component instance you would need to be able to inject the current context to be able to pass it as constructor argument.
We know that our support for fx:root isn't really good at the moment. The reason for this is that at our projects we usually don't use fx:root and therefore have no place to test features like this. However, we are happy to add support features for fx:root if possible. Therefore feedback of how we could design the API for such features is welcome.
Yes that's exactly what we did.
The idea with passing the context is a good idea although it need a little refactoring in our code but I guess it is worth the effort :)
Add support features for fx:root would be awesome and we will definitely provide some feedback. Thank you for your quick reply and your help.
Hi, we are using your amazing framework mvvmFX and we have now the problem that we want to share some information about different ViewModels. So far so good but now we have the situation which you are describing here https://github.com/sialcasa/mvvmFX/wiki/Scopes#context. We are loading our Views dynamically via code. The workaround is to use the Context and tell the FluentViewLoader in which context the view is loaded. But in our case it is a little bit difficult because we need some init data which needs to be passed to the constructor like this:
Is there any workaround to load the TestView via FluentViewLoader? Or is there another recommended way to pass the init data?