How to hide Minimize/Maximize buttons in RibbonWindow

Ribbon for WPF Forum

Posted 15 years ago by Johan Skoog
Version: 4.5.0487
Avatar
How can I hide the Minimize/Maximize buttons in a RibbonWindow?

I am able to disable the Maximize/Minimize from the Window menu using the Win32 interop by calling out the SetWindowLong, but this doesn't hide the buttons:

public class MyWindow : RibbonWindow
{
public MyWindow()
{
....
SourceInitialized += new EventHandler(Window_SourceInitialized);
}

void Window_SourceInitialized(object sender, EventArgs e)
{
IntPtr handle = (new WindowInteropHelper(this)).Handle;
ModifyStyle(handle, 0x00030000, 0);
}

bool ModifyStyle(IntPtr handle, int Remove, int Add)
{
const int GWL_STYLE = -16;
int Style = GetWindowLong(handle, GWL_STYLE);
int NewStyle = (Style & ~Remove) | Add;
if (Style == NewStyle)
return false;
SetWindowLong(handle, GWL_STYLE, NewStyle);
return true;
}
[DllImport("user32.dll")]
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
}

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Johan,

The buttons when Vista Aero glass is active are drawn by the system and not us. The buttons when Aero glass is not active (including XP/classic themes, etc.) are drawn by us in the RibbonWindow template however since there is no property on Window for hiding those buttons, we have no triggers to toggle them invisible with.


Actipro Software Support

Posted 15 years ago by JTango - Adelaide, Australia
Avatar
We actually require this exact functionality too. Do you guys have any recommendations on the best way to do it?
The latest build of this product (v24.1.3) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.