Resizing a response window

For response windows, the size can be set as a percentage of the parent window size. The code must be called in the OnLoaded WHO-method.

public override void OnLoaded()
{
    base.OnLoaded();

    ResizeWindowBasedOnScreenSize();
}
private void ResizeWindowBasedOnScreenSize()
{
    var window = WindowContent.FindVisualParent<CustomWindow>();
    if (window == null) return;
    
    WpfScreen.CenterInScreen(window, sizeRatio: 0.8);
}

Note: sizeRatio: 0.8 stands for response size of 80% of the parent window

Last updated