Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove WindowHelper from FilePicker sample code #1396

Conversation

AndrewKeepCoding
Copy link
Contributor

Description

Removed the WinUI3Helper class from the FilePicker sample code and showed how to get the MainWindow from the App class instead.

Motivation and Context

The sample code for the FilePicker controls uses the WindowHelper class which is implemented as a helper class in this project. This is very confusing because it looks like the WindowHelper class belongs to WinUI 3 and when one tries to use that code in their apps it just doesn't work. I find several questions in StackOverflow related to this and I think it's better not to use the WindowHelper in sample code.

How Has This Been Tested?

Run the app and confirmed its content.

Screenshots (if appropriate):

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)

@AndrewKeepCoding
Copy link
Contributor Author

@microsoft-github-policy-service agree

Copy link
Collaborator

@karkarl karkarl left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@karkarl karkarl merged commit b5f81eb into microsoft:main Jan 16, 2024
2 checks passed
@AndrewKeepCoding AndrewKeepCoding deleted the filepicker-sample-code-without-windowhelper branch January 16, 2024 23:36
@MartinZikmund
Copy link

@AndrewKeepCoding shouldn't the code snippets say App.MainWindow instead 👀?

@AndrewKeepCoding AndrewKeepCoding restored the filepicker-sample-code-without-windowhelper branch January 17, 2024 11:41
@AndrewKeepCoding
Copy link
Contributor Author

@MartinZikmund Thanks for pointing that out. 😵

@AndrewKeepCoding AndrewKeepCoding mentioned this pull request Jan 17, 2024
3 tasks
karkarl pushed a commit that referenced this pull request Jan 17, 2024
## Description
Corrects the `FilePicker` sample code modified by #1396.
karkarl pushed a commit that referenced this pull request Jul 15, 2024
## Description
Removed the WinUI3Helper class from the `FilePicker` sample code and
showed how to get the `MainWindow` from the `App` class instead.

## Motivation and Context
The sample code for the `FilePicker` controls uses the WindowHelper
class which is implemented as a helper class in this project. This is
very confusing because it looks like the WindowHelper class belongs to
WinUI 3 and when one tries to use that code in their apps it just
doesn't work. I find several questions in StackOverflow related to this
and I think it's better not to use the WindowHelper in sample code.
karkarl pushed a commit that referenced this pull request Jul 15, 2024
## Description
Corrects the `FilePicker` sample code modified by #1396.
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.

None yet

3 participants