-
Notifications
You must be signed in to change notification settings - Fork 472
Fix Windows Picker Initial Path is not set #3030
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the initial path/folder functionality for Windows file and folder pickers by migrating from the older Windows.Storage.Pickers API to the newer Microsoft.Windows.Storage.Pickers API. The implementation now properly sets the suggested folder path when opening pickers.
Key changes:
- Migrated to
Microsoft.Windows.Storage.PickersAPI for both FolderPicker and FileSaver on Windows - Implemented proper window retrieval using
IPlatformApplicationandMauiWinUIWindow - Added
SuggestedFolderproperty to set initial path for pickers - Enhanced error handling by separating cancellation from folder existence errors
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| FolderPickerImplementation.windows.cs | Updated to use new Windows picker API with proper initial path support and window handling |
| FileSaverImplementation.windows.cs | Updated to use new Windows picker API with proper initial path support and window handling |
| CommunityToolkit.Maui.Core.csproj | Added Microsoft.WindowsAppSDK dependency and updated System.Speech version |
| FolderPickerViewModel.cs | Sample code updated to demonstrate initial folder path usage |
| FileSaverViewModel.cs | Sample code updated to demonstrate initial folder path usage |
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.windows.cs
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.windows.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.windows.cs
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.windows.cs
Show resolved
Hide resolved
Refactored window retrieval in file/folder pickers to use pattern matching for clarity and modern C# style. Updated picker instantiation to use AppWindow.Id directly. Removed unused using statements. Changed csproj Windows ItemGroup condition to use $(NetVersion) for better .NET version flexibility. Cleaned up cancellation token registration variable naming.
Description of Change
Set initial folder for FilePicker and FolderPicker on Windows
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information