Page 1 of 1

Multiple ViewModel Connections in NoesisView

Posted: 19 Feb 2024, 07:38
by aliagha.huseynli
Hi Noesis Team members,

I have a ViewModel cs file with Monobehavior, INotifyPropertyChange.
It contains all data-binding properties.
Now I want to separate it into multiple view models that can operate concurrently.
However, I've encountered a limitation with
NoesisView.Content.DataContext = this;
which only permits a single view model connection.
How can I enable multiple view model connections simultaneously?

Thank you in advance for your assistance.

Re: Multiple ViewModel Connections in NoesisView

Posted: 19 Feb 2024, 11:58
by sfernandez
Hi, what do you mean by "multiple view models that can operate concurrently"?
A View can only be connected to a single view model at the same time, but inside the View you can point to different properties to access several sub-view models:
<Grid DataContext="{Binding ModelA}">...</Grid>
<Grid DataContext="{Binding ModelB}">...</Grid>
<Grid DataContext="{Binding ModelC}">...</Grid>
Is this what you are trying to do?

Re: Multiple ViewModel Connections in NoesisView

Posted: 20 Feb 2024, 07:32
by aliagha.huseynli
Yes. Thanks. It works :)