[UWP] Is it possible to remove maximize and mimize button from UWP app?

Md. Niaz Mahmud 171 Reputation points
2021-08-04T04:27:43.027+00:00

Is it possible to have a UWP app without maximize and minimize button, only the "X" button will be there??

120265-titlebar-close.png

Universal Windows Platform (UWP)
{count} votes

3 answers

Sort by: Most helpful
  1. Roy Li - MSFT 32,091 Reputation points Microsoft Vendor
    2021-08-04T07:47:15.767+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Is it possible to have a UWP app without maximize and minimize button, only the "X" button will be there??

    I have to say no, currently, there is no API in UWP that could remove these buttons. But there is an option that you could set the color of these buttons as transparent. Do you mind have a try?

    Like this:

            public MainPage()  
            {  
                this.InitializeComponent();  
      
                // Get the application view title bar  
                ApplicationViewTitleBar appTitleBar = ApplicationView.GetForCurrentView().TitleBar;  
                // Make the title bar transparent  
                appTitleBar.BackgroundColor = Colors.Transparent;  
                // make the button transparent  
                appTitleBar.ButtonBackgroundColor = Windows.UI.Colors.Transparent;  
                appTitleBar.BackgroundColor = Windows.UI.Colors.Transparent;  
            }  
    

    Thank you.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Glen Howard 0 Reputation points
    2024-03-21T06:19:30.61+00:00

    Yes. Just use the UWP compact overlay mode for an app targeting (I think) creators update or later. Just look it up,It will mean your app will remain on top but you can turn it off when the app looses focus. Minimise and maximise buttons are removed. If your using Win UI 3 however you can also use the Visual Tree Helper to navigate to the caption buttons (close, min and max) and collapse their visibility.

    To use compact overlay with VB...

    Dim AppView = ApplicationView.GetForCurrentView()

    Dim viewModePreference = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay)

    ApplicationView.PreferredLaunchViewSize = New Windows.Foundation.Size(300, 200)

    viewModePreference.CustomSize = New Windows.Foundation.Size(300, 200)

    AppView.SetPreferredMinSize(New Windows.Foundation.Size(300, 200))

    Dim result = Await AppView.TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay, viewModePreference)

    Some resizing may be reundant there. Test on your machine to be sure if each is needed.

    0 comments No comments

  3. Glen Howard 0 Reputation points
    2024-03-21T06:21:04.5733333+00:00

    Yes. Just use the UWP compact overlay mode for an app targeting (I think) creators update or later. Just look it up,It will mean your app will remain on top but you can turn it off when the app looses focus. Minimise and maximise buttons are removed. If your using Win UI 3 however you can also use the Visual Tree Helper to navigate to the caption buttons (close, min and max) and collapse their visibility.

    To use compact overlay with VB...

    Dim AppView = ApplicationView.GetForCurrentView()

    Dim viewModePreference = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay)

    ApplicationView.PreferredLaunchViewSize = New Windows.Foundation.Size(300, 200)

    viewModePreference.CustomSize = New Windows.Foundation.Size(300, 200)

    AppView.SetPreferredMinSize(New Windows.Foundation.Size(300, 200))

    Dim result = Await AppView.TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay, viewModePreference)

    Some resizing may be reundant there. Test on your machine to be sure if each is needed.

    0 comments No comments