Use a different DataContext (Data Set) for Components
Posted: 31 Jan 2025, 22:03
Hey,
I am trying to figure that our for some hours now. But I only run into crashes of Noesis or it just doesn't work at all.
I try to set up a second ViewModel for my component. So I go to the Data Panel and add a new Structure. In the Structure I add a Data Set and add a boolean value called "ShowButton" to the Structure. The boolean value is suppose to trigger the visibility of the Button when toggled. In my simplified example thats the whole ViewModel. Obviously in my game it would have all the data that are neccessary for the view.
When I edit the component and assign the second data set to the root. It looks all fine and I can set all the triggers up. So I go back to the MainPage and assign the first data set for the MainPage to the root of the MainPage. But this apparently overrides the ViewModel in this context for my component. I can't figure out how to make it work.
Am I doing something wrong? I feel a little stuck. Hope you can help me.
I am trying to figure that our for some hours now. But I only run into crashes of Noesis or it just doesn't work at all.
I try to set up a second ViewModel for my component. So I go to the Data Panel and add a new Structure. In the Structure I add a Data Set and add a boolean value called "ShowButton" to the Structure. The boolean value is suppose to trigger the visibility of the Button when toggled. In my simplified example thats the whole ViewModel. Obviously in my game it would have all the data that are neccessary for the view.
When I edit the component and assign the second data set to the root. It looks all fine and I can set all the triggers up. So I go back to the MainPage and assign the first data set for the MainPage to the root of the MainPage. But this apparently overrides the ViewModel in this context for my component. I can't figure out how to make it work.
Am I doing something wrong? I feel a little stuck. Hope you can help me.