I need help changing perspectives.
I am stuck trying to get closer to UWP like I did in WPF, relative to the MVVM pattern for managing UserControls dynamically.
Naturally, I tried to execute the same template in UWP, but got stuck on different things like UWP not supporting "x: Type" ...
Situation; to rethink this approach and look for a new direction. It seems I am forced to abandon the use of implicit binding similarly to the WPF template, using the Content Content Content property and VM property for the Object type, which support the selected ViewModel. It was a simple and straightforward approach to automatically match the correct view using the VM installed in ActiveViewModel.
below was such an easy way to control many views all over, odd MS not fixing it? But back to the big Q: what is now in UWP !?
<ContentPresenter Content="{Binding ActiveViewModel}">
<ContentPresenter.Resources>
<DataTemplate DataType="{x:Type local:OneViewModel}">
<local:OneView />
</DataTemplate>
<DataTemplate DataType="{x:Type local:TwoViewModel}">
<local:TwoView />
</DataTemplate>
</ContentPresenter.Resources>
</ContentPresenter>
What should I do instead !? Has anyone found a new effective way to do this? I am stuck in my stubborn mind and need someone to hit me in the ass, so I go ahead. The transition to the old is to change, but because of this profession it seems to me that I constantly have to. :)
source
share