Creating automatic resizing of subelements in WPF I currently have this code:



&lt;Window x:Class="Listener.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="600" Width="800" Loaded="Window_Loaded" WindowStyle="None" AllowsTransparency="True" Background="Transparent" MouseDown="Window_MouseDown" KeyDown="Window_KeyDown" ResizeMode="CanResizeWithGrip"&gt;
    &lt;Grid Margin="30" x:Name="bgBorder"&gt;
        &lt;Grid Margin="0" Background="#555555" x:Name="mainWindow" MouseDown="mainWindow_MouseDown"&gt;
            &lt;Grid Margin="2,2,2,2" Height="80" Background="#779999" x:Name="topControl" VerticalAlignment="Top"&gt;
            &lt;/Grid&gt;
            &lt;Grid Margin="2,84,238,2" Background="#557777" x:Name="playListControl"&gt;
            &lt;/Grid&gt;
            &lt;Grid Margin="2,84,2,2" Width="234" Background="#668888" x:Name="optionsControl" HorizontalAlignment="Right"&gt;
            &lt;/Grid&gt;
        &lt;/Grid&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;


A borderless window where the 3 sub panels get resized according to their margin and alignment.

Is this the correct way of doing this?

And on a side node, I plan on creating some sort of border resize and not use 

ResizeMode="CanResizeWithGrip"


This was just used for testing.
I would say no. If you want to create grid-like layout, you should declare columns and rows, and specify how wpf should stretch those. For example like this:

&lt;Grid Margin="30" x:Name="bgBorder"&gt;
    &lt;Grid Background="#555555" x:Name="mainWindow" MouseDown="mainWindow_MouseDown"&gt;
        &lt;Grid.RowDefinitions&gt;
            &lt;!-- frist row will stretch to fit the content --&gt;
            &lt;RowDefinition Height="Auto"/&gt;
            &lt;!-- second row will fill all available space --&gt;
            &lt;RowDefinition Height="*"/&gt;
        &lt;/Grid.RowDefinitions&gt;
        &lt;Grid Margin="2" Grid.Row="0" Height="80" Background="#779999" x:Name="topControl"/&gt;
        &lt;Grid Grid.Row="1"&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;!-- first column will fill all available space --&gt;
                &lt;ColumnDefinition Width="*"/&gt;
                &lt;!-- second column will stretch to fit the content --&gt;
                &lt;ColumnDefinition Width="Auto"/&gt;
            &lt;/Grid.ColumnDefinitions&gt;

            &lt;Grid Grid.Column="0" Margin="2" Background="#557777" x:Name="playListControl"/&gt;
            &lt;Grid Grid.Column="1" Margin="2" Width="234" Background="#668888" x:Name="optionsControl"/&gt;
        &lt;/Grid&gt;
    &lt;/Grid&gt;
&lt;/Grid&gt;


You should really do some reading on how things are done in wpf, this HTML-ish layout you are trying to create won't work.