Can anyone tell me how to remove the close (X) button from a WPF window? I can disable it by following code but can not remove it:
private const uint SC_CLOSE = 0xF060;
[DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hwnd, bool revert);
[DllImport("user32.dll")]
private static extern bool DeleteMenu(IntPtr hMenu, uint position, uint flags);
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WindowInteropHelper helper = new WindowInteropHelper(this);
IntPtr hwnd = GetSystemMenu(helper.Handle, false);
DeleteMenu(hwnd, SC_CLOSE, 0);
}