I am using the RibbonWindow for a status tray application, so when the user clicks the Close button, the window needs to be hidden and not displayed in the task bar. I'm seeing that the contents of the application are hidden, but the border of the app is still visible and I am able to resize the window. I was able to reproduce it on a test project with an empty RibbonWindow and the code below. Is there something else I need to set specifically for the RibbonWindow?
Thanks!
KC
public partial class MainWindow
{
[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
/// <summary>
/// Win32 API Constants for ShowWindowAsync()
/// </summary>
private const int SW_HIDE = 0;
private const int SW_SHOWNORMAL = 1;
private const int SW_SHOWMINIMIZED = 2;
private const int SW_SHOWMAXIMIZED = 3;
private const int SW_SHOWNOACTIVATE = 4;
private const int SW_RESTORE = 9;
private const int SW_SHOWDEFAULT = 10;
private IntPtr _mainWindow = IntPtr.Zero;
public MainWindow()
{
InitializeComponent();
this.Show();
var me = Process.GetCurrentProcess();
_mainWindow = me.MainWindowHandle;
}
private void MainWindow_OnClosing(object sender, CancelEventArgs e)
{
ShowWindowAsync(_mainWindow, SW_HIDE);
e.Cancel = true;
}
}