after some trial and error debugging i figured out, that the window visibility is setting to false, then update the system menu and after that setting to true.
i think this is not necessary and produces this nasty issue
here is the method at WindowChromeWorker
private void _UpdateSystemMenu(WindowState? assumeState)
{
const MF mfEnabled = MF.ENABLED | MF.BYCOMMAND;
const MF mfDisabled = MF.GRAYED | MF.DISABLED | MF.BYCOMMAND;
WindowState state = assumeState ?? _GetHwndState();
if (null != assumeState || _lastMenuState != state)
{
_lastMenuState = state;
bool modified = _ModifyStyle(WS.VISIBLE, 0);
IntPtr hmenu = NativeMethods.GetSystemMenu(_hwnd, false);
if (IntPtr.Zero != hmenu)
{
// change menu items
...
}
if (modified)
{
_ModifyStyle(0, WS.VISIBLE);
}
}
}
so you can try take a look into my branch of
WPF Shell Integration Library (Ex)tended Edition
original source can be found here
also here is a little test application
hope that helps