I dug up a little; there is a question https://stackoverflow.com/a/3186263/12332 which is regarding your problem. Oddly enough, this fix only works outside of Visual Studio.
Relevant parts of the answer ( Zach Johnson ):
It seems that WS_EX_DLGMODALFRAME deletes the icon only when the Win32 window in the Win32 window does not have an icon associated with it. WPF (conveniently) uses the application icon as the default icon for all windows without an explicitly set icon. Usually this does not cause any problems and eliminates the need to manually install the application icon in each window; however, this creates a problem for us when we try to remove the icon.
Since the problem is that WPF automatically sets the window icon for us, we can send WM_SETICON to the Win32 window to reset its icon when we apply WS_EX_DLGMODALFRAME .
const int WM_SETICON = 0x0080; const int ICON_SMALL = 0; const int ICON_BIG = 1; [DllImport("User32.dll", CharSet = CharSet.Auto, SetLastError = true)] static extern IntPtr SendMessage( IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
Code to remove the icon:
IntPtr hWnd = new WindowInteropHelper(window).Handle; int currentStyle = NativeMethods.GetWindowLongPtr(hWnd, GWL_EXSTYLE); SetWindowLongPtr( hWnd, GWL_EXSTYLE, currentStyle | WS_EX_DLGMODALFRAME);
It only works when the application starts outside of Visual Studio.
Ggulati
source share