Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

MVVM DataTemplate and ContentPresenter

$
0
0

In my example i have a MainView and in that i want to show a UserControl (ParentView). I'm trying to use MVVM so i also have a MainVM and a ParentVM.

In a resource file i have following code: 

        <DataTemplate x:Key="PVM" DataType="{x:Type local:ParentVM}">
            <local:ParentView />
        </DataTemplate>

The MainVM creates and instance of ParentVM. Instead of adding my ParentView to my MainView in XAML I want to use a ContentPresenter on my MainView. I just can get my ParentView to show up in my MainView when using the ContentPresenter. Can someone help me with this?

Thanks

AHR

 


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>