title: How to hide the close button in a MahApps.Metro window?
body: <p>I'm trying to hide/remove the close button on my MahApps MetroWindow without success.</p>
  
  <p>I've tried with this code:</p>
  
  <pre><code>private const int GWL_STYLE = -16;
  private const int WS_SYSMENU = 0x80000;
  [DllImport("user32.dll", SetLastError = true)]
  private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
  [DllImport("user32.dll")]
  
  private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
  
  private void Window_Loaded(object sender, RoutedEventArgs e)
  {
          var hwnd = new WindowInteropHelper(this).Handle;
          SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) &amp; ~WS_SYSMENU);
  }
  </code></pre>
  
  <p>I've also set up some properties:</p>
  
  <pre><code>...ShowTitleBar="False" WindowStyle="None" ResizeMode="NoResize" 
      Loaded="Window_Loaded" ...
  </code></pre>
  
  <p>So the Window_Loaded is trigger correctly but the code of this <a href="https://stackoverflow.com/questions/743906/how-to-hide-close-button-in-wpf-window">question</a> seems not working.</p>
  
  <p>This is the actual result:</p>
  
  <p><a href="https://i.stack.imgur.com/E60W9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E60W9.png" alt="enter image description here"></a></p>
  
  <p>Why the button don't disappear? What I'm doing wrong?</p>