You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to disable Minimize button in title bar in WPF window.
When I set ui:WindowHelper.UseModernWindowStyle="False" in xaml, I was able to implement by the following code.
[DllImport( "user32.dll" )]
static extern int GetWindowLong ( IntPtr hWnd, int nIndex );
[DllImport( "user32.dll" )]
static extern int SetWindowLong ( IntPtr hWnd, int nIndex, int dwNewLong );
private const int GWL_STYLE = -16;
private const int WS_MINIMIZEBOX = 0x20000;
protected override void OnSourceInitialized ( EventArgs e ) {
base.OnSourceInitialized( e );
IntPtr handle = new WindowInteropHelper( this ).Handle;
var style = GetWindowLong( handle, GWL_STYLE );
style &= ~WS_MINIMIZEBOX;
_ = SetWindowLong( handle, GWL_STYLE, style );
}
However, when I set ui:WindowHelper.UseModernWindowStyle="True", this code does not work. The Minimize button is still valid.
I want to use UseModernWindowStyle="True" to apply to mode change (dark/ light mode).
Do you know how to solve this problem?
The text was updated successfully, but these errors were encountered:
I would like to disable Minimize button in title bar in WPF window.
When I set ui:WindowHelper.UseModernWindowStyle="False" in xaml, I was able to implement by the following code.
However, when I set ui:WindowHelper.UseModernWindowStyle="True", this code does not work. The Minimize button is still valid.
I want to use UseModernWindowStyle="True" to apply to mode change (dark/ light mode).
Do you know how to solve this problem?
The text was updated successfully, but these errors were encountered: