Share via

How to restrict resize of windows size in Print support app

Ambigavathi Dhanapal 5 Reputation points
2026-06-18T04:17:51.7966667+00:00

We are developing print support app for label printer. We need to restrict the resize option of the window when user click printing preferences from printer properties. is there any option to do this?

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Senthil kumar 685 Reputation points
    2026-06-18T05:01:20.01+00:00

    Hi @Ambigavathi Dhanapal

    • Goto devices and printers-> select your label printer-> select print server properties -> tick create a new form

    -> give your label form name -> set label size width and height -> click apply & ok.

    • after that goto printer properties -> preferences -> go to paper size selection -> choose created label size.

    Untitled

    User's image

    Thanks.

    Was this answer helpful?


  2. AI answer

    2026-06-18T04:18:09.6766667+00:00

    For a Print Support App (or any WinUI 3 / Windows App SDK window) the resize behavior is controlled via the windowing APIs, not via the printer preferences entry point itself.

    To restrict user resizing, use the AppWindowPresenter (typically OverlappedPresenter) associated with the app’s AppWindow:

    1. Get the AppWindow for the current window.
    2. Cast its Presenter to OverlappedPresenter.
    3. Configure the presenter:
      • Set IsResizable to false to prevent user resizing.
      • Optionally set PreferredMinimumWidth/Height and PreferredMaximumWidth/Height to constrain the size range.

    Example (C# / Windows App SDK):

    using Microsoft.UI.Windowing;
    using Microsoft.UI.Xaml;
    
    public sealed partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.InitializeComponent();
    
            var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
            var windowId = Win32Interop.GetWindowIdFromWindow(hwnd);
            var appWindow = AppWindow.GetFromWindowId(windowId);
    
            if (appWindow.Presenter is OverlappedPresenter presenter)
            {
                presenter.IsResizable = false; // disable user resize
    
                // Optional: constrain size if needed
                presenter.PreferredMinimumWidth = 400;
                presenter.PreferredMinimumHeight = 300;
                presenter.PreferredMaximumWidth = 400;
                presenter.PreferredMaximumHeight = 300;
            }
        }
    }
    

    Notes based on the platform behavior:

    • IsResizable = false hides the resize controls and prevents user resizing, but does not block programmatic calls to AppWindow.Resize.
    • PreferredMinimumHeight/Width and PreferredMaximumHeight/Width constrain both user resizing and AppWindow.Resize calls; the window cannot be resized outside that range.
    • If a fixed-size dialog is desired, set min and max to the same values and keep IsMaximizable false.

    This approach lets the Print Support App’s printing-preferences window behave like a fixed-size dialog when invoked from printer properties.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.