Skip to content

Add AppWindow Sample - #1781

Merged
Niels Laute (niels9001) merged 36 commits into
microsoft:mainfrom
Zakariathr22:AppWindow
Mar 8, 2025
Merged

Niels Laute (niels9001) merged 36 commits into
microsoft:mainfrom
Zakariathr22:AppWindow

Conversation

@Zakariathr22

@Zakariathr22 Zakaria Tahri (Zakariathr22) commented Feb 18, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR adds an AppWindow sample to the Gallery. Main changes:

  • Added sample info to ControlInfoData.json.
  • Added AppWindowPage.
  • Added sample windows.
  • Added sample code files.

The examples demonstrate AppWindow and its presenters like OverlappedPresenter, FullScreenPresenter, and CompactOverlayPresenter, along with their properties and functionalities.

Motivation and Context

Closes #1771
Closes #1552

How Has This Been Tested?

Manually tested

Screenshots (if appropriate):

image
image
image
image
image
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
@Zakariathr22 Zakaria Tahri (Zakariathr22) changed the title App window Feb 18, 2025
Comment thread WinUIGallery/Samples/ControlPages/AppWindowPage.xaml Outdated
Comment thread WinUIGallery/Samples/ControlPages/AppWindowPage.xaml Outdated

@niels9001 Niels Laute (niels9001) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERY excited to see this 😄!!!

I know this is still in progress but left a few comments

@Zakariathr22

Copy link
Copy Markdown
Contributor Author

VERY excited to see this 😄!!!

I know this is still in progress but left a few comments

I'm also excited to finish it. I'll try my best.

@Zakariathr22

Zakaria Tahri (Zakariathr22) commented Feb 20, 2025 •

Copy link
Copy Markdown
Contributor Author

Niels Laute (@niels9001), we will need a control image for this if it is going to be merged
image

@MGGSK

Copy link
Copy Markdown
Contributor

Does this close #1552?

@Zakariathr22

Zakaria Tahri (Zakariathr22) commented Feb 22, 2025 •

Copy link
Copy Markdown
Contributor Author

Does this close #1552?

Yes, this addresses the same issue. It closes #1552.
Thanks for pointing to this.

@niels9001

Copy link
Copy Markdown
Collaborator

Niels Laute (@niels9001), we will need a control image for this if it is going to be merged image

AppWindow

Here you go!

@Zakariathr22

Copy link
Copy Markdown
Contributor Author

AppWindow

Here you go!

Thanks! 😊

Added tooltips for `IsMaximizable` and `IsMinimizable`
in `AppWindowPage.xaml` to clarify their functionality.

Updated the `SetOwnership` method in `ModalWindow`
to rename parameters for better clarity and consistency
across `AppWindowSample4_cs.txt` and `ModalWindow.xaml.cs`.
A comment was also added to explain how to retrieve
the main window from `App.xaml.cs`.

(This commit message was generated by Copilot)
@Zakariathr22

Copy link
Copy Markdown
Contributor Author

Important

These notes for whoever will review this code:

Based on this, I believe we can proceed with this approach, as the lack of formal documentation does not preclude its effective use.

@niels9001 Niels Laute (niels9001) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! Thanks so much for this contribution Zakaria Tahri (@Zakariathr22) !

@Zakariathr22

Copy link
Copy Markdown
Contributor Author

Amazing work! Thanks so much for this contribution Zakaria Tahri (@Zakariathr22) !

You're very welcome! 🚀

  • The modal window example sets the owner using SetWindowLongPtr/SetWindowLong with index -8 (GWL..._HWNDPARENT), ensuring reliable modal behavior. However, I should note that this is an undocumented approach.

And about the previous note,
I created a PR to document HWNDPARENT (-8) for SetWindowLong_ to clarify window ownership. It was approved and merged, so it's just a matter of time until it's released. No need to worry about it!

For more details, see the PR: MicrosoftDocs/sdk-api#1982.

@niels9001
Niels Laute (niels9001) enabled auto-merge (squash) March 8, 2025 18:23
@niels9001

Copy link
Copy Markdown
Collaborator

/azp run

@niels9001
Niels Laute (niels9001) merged commit 802eb5d into microsoft:main Mar 8, 2025
@Zakariathr22
Zakaria Tahri (Zakariathr22) deleted the AppWindow branch March 8, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants