Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a new window (Project->Add WPf Window)
I can't see it on page 2 (as a parent)

is displayed, but not where I would like it 

in C# it's easy to create Parent, in Wpf I don't understand which one to use between Owner, Parent, Child


What I have tried:

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <DockPanel HorizontalAlignment="Left" Height="411" LastChildFill="False" Margin="0,0,0,0" VerticalAlignment="Top" Width="782" RenderTransformOrigin="0.5,0.5" Cursor="Hand" Background="#FF230FE6">
        <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" Margin="2,5" Background="#FFAE2608" Height="36">
            <Button Name="btnPreviousTab" Width="70">Prev.</Button>
            <Button Name="btnNextTab" Width="70">Next</Button>
            <Button Name="btnSelectedTab" Width="70">Selected</Button>
        </StackPanel>
        <TabControl Name="tcSample" Width="735">
            <TabItem x:Name="Pagina1" Header="General">
                <Label Content="Test here..." />
            </TabItem>
            <TabItem x:Name="Pagina2" Header="Security" />
            <TabItem x:Name="Pagina3" Header="Details" />
        </TabControl>
    </DockPanel>
</Window>


private void btnSelectedTab_Click(object sender, RoutedEventArgs e)
        {
            Window oWindow = new Window1();
            Pagina2.Content = oWindow.Content;                                   
            oWindow.Show();            
        }
Posted
Updated 7-Nov-19 6:33am

1 solution

The "reference" assignment has nothing to do where the Window shows up; "windows" are "containers" that are NOT otherwise contained.

If you're thinking "MDI", that only applies to Windows Forms.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900