title: How to embed WPF Window into another Window and adjust its size via XAML or code
body: <p>First of all it's my first day using Xaml so this question might be dummy for you, but i totally got lost.</p>
  
  <h1>Overview</h1>
  
  <p>My technique is that i have MainWindow.xaml and it's split into three areas (using grid columns) the columns width being set automatically.</p>
  
  <p>Based on some actions in the right column, the middle column with show a page let's say Page.xaml that exists in different namespace.</p>
  
  <h1>What i'm seeking for</h1>
  
  <p>The problem is i need to set the width and height for this page to be equal the middle column width and height as it will fit this area.</p>
  
  <h1>Notes</h1>
  
  <p>I have very small experience with xaml and binding techniques.</p>
  
  <blockquote>
    <p>MainWindow.Xaml</p>
  </blockquote>
  
  <pre><code>&lt;Window 
      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" mc:Ignorable="d" 
      WindowState="Maximized"
      ResizeMode="NoResize"
      WindowStartupLocation="CenterScreen"
      Title="MainWindow" d:DesignWidth="1366" d:DesignHeight="768"&gt;
  
  &lt;Grid x:Name="MainGrid"&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="1.2*" x:Name="LeftColoumn" /&gt;
          &lt;ColumnDefinition Width="3*" x:Name="CenterColoumn" /&gt;
          &lt;ColumnDefinition Width=".8*" x:Name="RightColoumn" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
  
      &lt;ScrollViewer Grid.Column="2"&gt;
          &lt;StackPanel Orientation="Vertical" x:Name="RightStackPanel" Background="LightGray" &gt;
              &lt;Border BorderBrush="{x:Null}" Height="50" &gt;
                  &lt;TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" FontWeight="SemiBold" FontStyle="Normal" Margin="3" FontSize="20" &gt;Others&lt;/TextBlock&gt;
              &lt;/Border&gt;
              &lt;Expander x:Name="Expander1" Header="Others" Margin="0,0,10,0"&gt;
                  &lt;Button  Margin="0,0,0,0"  Width="{Binding ActualWidth, ElementName=RightStackPanel}" Background="White" Content="Add" Height="50" Click="Button_Click" &gt;&lt;/Button&gt;
              &lt;/Expander&gt;
  
          &lt;/StackPanel&gt;
      &lt;/ScrollViewer&gt;
  
      &lt;Frame  Grid.Column="0" x:Name="LeftFrame" Background="LightGray"  &gt;&lt;/Frame&gt;
      &lt;Frame  Grid.Column="1" x:Name="CenterFrame" Background="DarkGray" &gt;&lt;/Frame&gt;
  
  &lt;/Grid&gt;&lt;/Window&gt;
  </code></pre>
  
  <blockquote>
    <p>Other Xaml file</p>
  </blockquote>
  
  <pre><code>&lt;Page
    x:Name="Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d"
    Title="Any" d:DesignWidth="1364" d:DesignHeight="868"
    &gt;
  
  &lt;Grid&gt;
      &lt;Frame   Background="DarkGray" /&gt;
  
  &lt;/Grid&gt;&lt;/Page&gt;
  </code></pre>
  
  <blockquote>
    <p>MainWindow.xaml.cs</p>
  </blockquote>
  
  <pre><code>private void Button_Click(object sender, RoutedEventArgs e)
      {
          Frame middleFrame=CenterColumn;
          Otherxaml other=new Otherxaml();
          middleFrame.Source = new Uri("OtherxamlPage.xaml", UriKind.RelativeOrAbsolute);
      }
  </code></pre>