Skip to content

Add AppWindow Sample#1781

Merged
niels9001 merged 36 commits intomicrosoft:mainfrom
Zakariathr22:AppWindow
Mar 8, 2025
Merged

Add AppWindow Sample#1781
niels9001 merged 36 commits intomicrosoft:mainfrom
Zakariathr22:AppWindow

Conversation

@Zakariathr22
Copy link
Contributor

@Zakariathr22 Zakariathr22 commented Feb 18, 2025

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 Zakariathr22 changed the title App window Add AppWindow Sample Feb 18, 2025
Copy link
Collaborator

@niels9001 niels9001 left a comment

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
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 Zakariathr22 marked this pull request as ready for review February 20, 2025 13:33
@Zakariathr22
Copy link
Contributor Author

Zakariathr22 commented Feb 20, 2025

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

@MGGSK
Copy link
Contributor

MGGSK commented Feb 22, 2025

Does this close #1552?

@Zakariathr22
Copy link
Contributor Author

Zakariathr22 commented Feb 22, 2025

Does this close #1552?

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

@niels9001
Copy link
Collaborator

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

AppWindow

Here you go!

@Zakariathr22
Copy link
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
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.

Copy link
Collaborator

@niels9001 niels9001 left a comment

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 @Zakariathr22 !

@Zakariathr22
Copy link
Contributor Author

Amazing work! Thanks so much for this contribution @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 niels9001 enabled auto-merge (squash) March 8, 2025 18:23
@niels9001
Copy link
Collaborator

/azp run

@niels9001 niels9001 merged commit 802eb5d into microsoft:main Mar 8, 2025
2 checks passed
@Zakariathr22 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Add AppWindow Page to the Windowing Section AppWindow Presenter related samples

3 participants