Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
460
Hide icon in floating pane
posted

Hi,

on my computer,
if I drag a ContentPane out of the XamDockManager,
the resulting floating pane does not have an icon in the upper left corner, regardless of the Image property being set or not.

I think that this is the desired behavior because the Image property is only for the tab headers. This is also what I want.

However, on a coworker's computer (same code),
if I drag a ContentPane out of the XamDockManager,
the resulting floating pane always shows the default Windows icon in the upper left corner.

How can I prevent that (I don't know what setting on his computer causes this behavior)?

I am using this code to hide the standard Windows icon for non-DockManager child windows in my application, and this works on both computers:

protected override void OnSourceInitialized(EventArgs e)
{
            base.OnSourceInitialized(e);
            IntPtr hwnd = new WindowInteropHelper(window).Handle;

            // Change the extended window style to not show a window icon
            var extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
            SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME);

            // Update the window's non-client area to reflect the changes
            SetWindowPos(hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
            SendMessage(hwnd, WM_SETICON, new IntPtr(1), IntPtr.Zero);
            SendMessage(hwnd, WM_SETICON, IntPtr.Zero, IntPtr.Zero);
}

Unfortunately I have no access to ToolWindowHostWindow, so I cannot do the same for floating panes in the XamDockManager. Calling this code in the ToolWindowLoaded event handler doesn't do anything.

Thanks,

Tjark

Parents
  • 460
    Offline posted

    Some additional details:

    A minimal working example to demonstrate the problem would be

    a WPF window
    containing a XamDockManager
    with AllowMaximizeFloatingWindows="True"
    containing a SplitPane
    containing an empty ContentPane.

    Run this app, the drag the ContentPane out of the XamDockManager.

    On my machine, no icon appears in the upper left corner of the ToolWindowHostWindow.

    On my colleague's machine, a standard Windows icon appears in the upper left corner of the ToolWindowHostWindow.

    I want to prevent the latter (I think the code that I posted above could help, but I cannot override OnSourceInitialized of ToolWIndowHostWindow because it's protected).

Reply Children