title: UWP grid to fill parent window
body: <p>We are working on a school project and has run into a dead end. We are trying to make the <code>grid</code> fill the entire parent window but we are simply not able to do so. </p>
  
  <p>This is what the designer shows and how we want it to look:
  <a href="https://i.stack.imgur.com/Zo0QU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Zo0QU.png" alt="enter image description here"></a></p>
  
  <p>And this is how it looks when we run it:
  <a href="https://i.stack.imgur.com/O0el9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/O0el9.png" alt="enter image description here"></a></p>
  
  <p>Here is our xaml code:</p>
  
  <pre><code>&lt;Grid x:Name="Grid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="{Binding ActualWidth, RelativeSource = {RelativeSource Mode=TemplatedParent}}" Height="{Binding ActualHeight, RelativeSource ={RelativeSource Mode=TemplatedParent}}"&gt;
      &lt;Grid.Background&gt;
          &lt;ImageBrush Stretch="UniformToFill" ImageSource="Assets/france_countryside.jpg" Opacity="0.4" /&gt;
      &lt;/Grid.Background&gt;
  
      &lt;!--Search section--&gt;
  
      &lt;RelativePanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="{Binding ElementName=Grid,Path=ActualWidth}"&gt;
          &lt;TextBlock Text="Find available apartment" FontSize="24" Margin="30" RelativePanel.AlignHorizontalCenterWithPanel="True" /&gt;
          &lt;AutoSuggestBox Name="AutoSuggestBox" 
                          PlaceholderText="Search" 
                          Width="300" 
                          RelativePanel.AlignHorizontalCenterWithPanel="True" 
                          Margin="0,100,0,0"
                          TextChanged="AutoSuggestBox_OnTextChanged"
                          Header="Destination:"/&gt;
          &lt;CalendarDatePicker Name="CheckInPicker" Header="Check in:" RelativePanel.Below="AutoSuggestBox" RelativePanel.AlignLeftWith="AutoSuggestBox" Margin="0,40,0,0" PlaceholderText="select a date" IsTodayHighlighted="False"/&gt;
          &lt;CalendarDatePicker Name="CheckOutPicker" Header="Check out:" RelativePanel.Below="AutoSuggestBox" RelativePanel.AlignRightWith="AutoSuggestBox" Margin="0,40,0,0"/&gt;
          &lt;ComboBox x:Name="numberOfGuestsBox"  Width="127" RelativePanel.Below="CheckInPicker" RelativePanel.AlignLeftWith="AutoSuggestBox" Margin="0,30,0,0" PlaceholderText="Choose" Header="Guests:" FontSize="15"&gt;
              &lt;x:String&gt;1&lt;/x:String&gt;
              &lt;x:String&gt;2&lt;/x:String&gt;
              &lt;x:String&gt;3&lt;/x:String&gt;
              &lt;x:String&gt;4&lt;/x:String&gt;
              &lt;x:String&gt;5&lt;/x:String&gt;
              &lt;x:String&gt;6&lt;/x:String&gt;
              &lt;x:String&gt;7&lt;/x:String&gt;
              &lt;x:String&gt;8&lt;/x:String&gt;
              &lt;x:String&gt;9&lt;/x:String&gt;
              &lt;x:String&gt;10&lt;/x:String&gt;
          &lt;/ComboBox&gt;
          &lt;ToggleSwitch Header="Smoking allowed?" Margin="0,30,0,0" RelativePanel.Below="CheckOutPicker" RelativePanel.AlignLeftWith="CheckOutPicker" OffContent="Eew - No!" OnContent="Ya man!"/&gt;
          &lt;Button x:Name="SearchButton" Content="Search available apartments" RelativePanel.Below="numberOfGuestsBox" RelativePanel.AlignHorizontalCenterWithPanel="True" Margin="0,30,0,30" Width="300" Height="50" Background="MediumSeaGreen" Foreground="AliceBlue" Click="SearchButton_Click"/&gt;
      &lt;/RelativePanel&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>How do we go about this?<br>
  We have tried what to us seems everything with stretching. Margin is not really an option as we want it to be able to re-size.  </p>
  
  <p>It seems like (to us) that the grid is fitting the relative panel and shrinks to that size. We are somewhat sure that if we get the grid to fit the screen size of the window the relative panel will be placed in the middle. Thanks for your help in advance!</p>
  
  <hr>
  
  <p><strong>Edit:</strong></p>
  
  <p>We hold the "views" inside a frame that might be causing the problem. When i re-size the frame the image re-sized and the splitview moves to the "middle" but the scaling doesn't work on the splitview nor the picture.</p>
  
  <p>Here is the code for the splitview:</p>
  
  <pre><code>    &lt;!--Split View--&gt;
      &lt;SplitView Name="MySplitView" 
                 Grid.Row="1" 
                 DisplayMode="CompactOverlay" 
                 OpenPaneLength="200" 
                 CompactPaneLength="48" 
                 HorizontalAlignment="Left"&gt;
  
          &lt;!--SplitView Pane for icons--&gt;
          &lt;SplitView.Pane&gt;
              &lt;ListBox Name="IconsLIstBox" SelectionMode="Single" SelectionChanged="IconsLIstBox_OnSelectionChanged"&gt;
                  &lt;ListBoxItem Name="HomeListItem"&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;TextBlock FontFamily="Segoe MDL2 Assets" FontSize="24" Text="&amp;#xE10F;"/&gt;
                          &lt;TextBlock Text="Home" Margin="20,0,0,0"/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/ListBoxItem&gt;
                  &lt;ListBoxItem Name="LocationsListBoxItem"&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;TextBlock FontFamily="Segoe MDL2 Assets" FontSize="24" Text="&amp;#xE1D1;"/&gt;
                          &lt;TextBlock Text="Locations" Margin="20,0,0,0"/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/ListBoxItem&gt;
                  &lt;ListBoxItem Name="MostPopularListBoxItem"&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;TextBlock FontFamily="Segoe MDL2 Assets" FontSize="24" Text="&amp;#xE24A;"/&gt;
                          &lt;TextBlock Text="Most Popular" Margin="20,0,0,0"/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/ListBoxItem&gt;
                  &lt;ListBoxItem Name="MapListBoxItem"&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;TextBlock FontFamily="Segoe MDL2 Assets" FontSize="24" Text="&amp;#xE128;"/&gt;
                          &lt;TextBlock Text="Map" Margin="20,0,0,0"/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/ListBoxItem&gt;
                  &lt;ListBoxItem Name="ProfileListBoxItem"&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;TextBlock FontFamily="Segoe MDL2 Assets" FontSize="24" Text="&amp;#xE170;"/&gt;
                          &lt;TextBlock Text="Profile" Margin="20,0,0,0"/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/ListBoxItem&gt;
                  &lt;ListBoxItem Name="ContactListBoxItem"&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;TextBlock FontFamily="Segoe MDL2 Assets" FontSize="24" Text="&amp;#xE166;"/&gt;
                          &lt;TextBlock Text="Contact" Margin="20,0,0,0"/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/ListBoxItem&gt;
              &lt;/ListBox&gt;
          &lt;/SplitView.Pane&gt;
  
          &lt;!--SplitView Content--&gt;
          &lt;Frame x:Name="MyFrame" HorizontalAlignment="Left" Width="1043"/&gt;
      &lt;/SplitView&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p>We've tried with the frame being inside a <code>splitview.content</code> but there is no difference between the two.</p>