WPF Form disapears whenever I add `NoResize` property
===

I am trying to use WPF to create a dock application in the style of [the Dell Dock][1] and it is going well so far.

My WPF form appears like so on my screen:

![John Dock][2]

The XAML for my form is below:

    <Window x:Class="WpfApplication7.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="130" Width="525" Loaded="Window_Loaded" Background="Transparent" WindowStyle="None">
        <Grid>
        </Grid>
    </Window>

I found a tutorial on the Microsoft website to add the Aero Glass effect. With this in mind, my code is below:

    using System;
    using System.Drawing;
    using System.Runtime.InteropServices;
    using System.Windows;
    using System.Windows.Forms;
    using System.Windows.Interop;
    
    namespace WpfApplication7
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }
    
            private void Window_Loaded(object sender, RoutedEventArgs e)
            {
                MakeTransparent();
    
                Topmost = true;
    
    
                var screenWidth = SystemInformation.PrimaryMonitorSize.Width;
                var startingPoint = (screenWidth / 2) - (Width / 2);
    
                Top = 2;
                Left = startingPoint;
    
                
                Console.ReadLine();
            }
    
            private void MakeTransparent()
            {
                IntPtr mainWindowPtr = new WindowInteropHelper(this).Handle;
                HwndSource mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr);
                mainWindowSrc.CompositionTarget.BackgroundColor = System.Windows.Media.Color.FromArgb(0, 0, 0, 0);
    
                Graphics desktop = Graphics.FromHwnd(mainWindowPtr);
                float DesktopDpiX = desktop.DpiX;
                float DesktopDpiY = desktop.DpiY;
    
                MARGINS margins = new MARGINS()
                {
                    cxLeftWidth = 0,
                    cxRightWidth = Convert.ToInt32(Width) * Convert.ToInt32(Width),
                    cyTopHeight = 0,
                    cyBottomHeight = Convert.ToInt32(Height) * Convert.ToInt32(Height)
                };
    
                int hr = DwmExtendFrameIntoClientArea(mainWindowSrc.Handle, ref margins);
            }
    
            [StructLayout(LayoutKind.Sequential)]
            public struct MARGINS
            {
                public int cxLeftWidth;
                public int cxRightWidth;
                public int cyTopHeight;
                public int cyBottomHeight;
            }
    
            [DllImport("DwmApi.dll")]
            public static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS pMarInset);
        }
    }

So far so good. However, my form is resizable which I don't want so I set the `ResizeMode` property to `NoResize` and whenever I do this my form is nowhere to be found when launched.

Why does this happen?

Thanks

  [1]: http://www.delldock.com/images/version15d/dell_dock.jpg
  [2]: http://i.stack.imgur.com/otKNl.jpg