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);
}
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);
}