# Other .NET Programming > Windows Presentation Foundation (WPF) & XAML forum >  Using ContentPresenter in WPF

## mitunit

Hello,

I've the following xaml code in my C#/WPF app.

I need to be able to display the contents of View1 after those textblocks and textboxes.Instead, the contents of 

View1 are now appearing after StackPanel contents. 

What am I missing here please? Thanks for your help.



```
<Window

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:MainViewModel="clr-namespace:MyTool.ViewModel"
        xmlns:ViewModel="clr-namespace:MyTool.ViewModel.MyProducts"
        xmlns:View="clr-namespace:MyTool.View" x:Class="MyTool.MainWindow"
        xmlns:Views="clr-namespace:MyTool.View.MyProducts"
        xmlns:v="clr-namespace:MyTool.View.MyProducts"
        xmlns:vm="clr-namespace:MyTool.ViewModel.MyProducts"
        Title="{Binding DisplayName, Mode=OneWay}" ResizeMode="CanResize" WindowStartupLocation="CenterScreen">
    <Window.DataContext>
        <MainViewModel:MyViewModel/>
    </Window.DataContext>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0"  HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Horizontal" Height="28" Width="auto" Margin="5,0,0,0">
            <TextBlock TextWrapping="Wrap" Text="Product Type" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,5,0" Style="{DynamicResource DefaultTextBlockStyle}"/>
            <ComboBox Width="360" Margin="1,0".... TabIndex="0" />


            <Button x:Name="btnSave" Content=" Save " Margin="25,0,5,0" Command="{Binding SaveCommand, Mode=OneWay}" TabIndex="31" />

            <Button Content=" Clear " Command="{Binding ClearCommand, Mode=OneWay}" Margin="0,0,5,0" TabIndex="34"/>
        </StackPanel>

        <Grid Margin="5" Grid.Row="1" >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="Auto" MinHeight="24"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="200"/>
                <ColumnDefinition Width="23"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="14*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="71*"/>
            </Grid.ColumnDefinitions>
        <!--Block2
                 10 TextBlocks and TextBoxes
        -->
            <ContentPresenter Content="{Binding CurrentViewModel}">
                <ContentPresenter.Resources>
                    <DataTemplate DataType="{x:Type ViewModel:VM1}">
                        <Views:View1/>
                    </DataTemplate>
                    <DataTemplate DataType="{x:Type ViewModel:VM2">
                        <Views:View2/>
                    </DataTemplate>                  
                </ContentPresenter.Resources>
            </ContentPresenter>

        </Grid>
    </Grid>
</Window>
```

----------

