New to Telerik UI for WPF? Start a free 30-day trial
Prevent Double-Click Maximization on RadWindow
Updated on Sep 15, 2025
Environment
| Product Version | 2021.3.914 |
| Product | RadWindow for WPF |
Description
How to prevent maximization on the RadWindow control, when the title bar is double-clicked.
Solution
To achieve this, you could subscribe to the HostCreated event of the Window control, and inside of it, set the SourceInitialized event of the HostWindow property provided by the HostWindowCreatedEventArgs event arguments. Additionally, several fields and methods from the Win32 API would be required, which are present in the below code snippet.
C#
public partial class MainWindow : RadWindow
{
public MainWindow()
{
InitializeComponent();
this.HostCreated += MainWindow_HostCreated;
}
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_STYLE = -16;
private const int WS_MAXIMIZEBOX = 0x10000;
private void MainWindow_HostCreated(object sender, HostWindowCreatedEventArgs e)
{
e.HostWindow.SourceInitialized += Window_SourceInitialized;
}
private void Window_SourceInitialized(object sender, EventArgs e)
{
IntPtr hwnd = new WindowInteropHelper((Window)sender).Handle;
var value = GetWindowLong(hwnd, GWL_STYLE);
SetWindowLong(hwnd, GWL_STYLE, (int)(value & ~WS_MAXIMIZEBOX));
}
}