[Settings][Image Resizer] Edit/add presets in a ContentDialog instead of a Flyout#49161
Open
niels9001 wants to merge 3 commits into
Open
[Settings][Image Resizer] Edit/add presets in a ContentDialog instead of a Flyout#49161niels9001 wants to merge 3 commits into
niels9001 wants to merge 3 commits into
Conversation
Replace the inline preset-edit Flyout with a ContentDialog that matches
the Color Picker add/edit pattern. Editing now happens on a working copy
(ImageSize.Clone) that is committed only when the user hits Save, so the
intermediate width/height spinner changes no longer persist settings.json
and sizes.json on every change. The dialog uses compiled {x:Bind}
bindings and a dynamic Width/Size field header.
Also move the per-row delete action into a "..." MenuFlyout (matching the
Color Picker page) instead of an inline trash button.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- De-duplicate the legacy AddImageSize(string) into a thin wrapper over CreateNewImageSizeModel + AddImageSize(ImageSize). - Drop the dead "Remove" mapping from ImageResizerSizeToAccessibleTextConverter (delete now lives in the "..." MenuFlyout, so no XAML passes 'Remove'). - Remove 6 resw entries orphaned by replacing the Flyout with the dialog. - Add unit tests for CreateNewImageSizeModel, AddImageSize(ImageSize) and UpdateImageSize. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fix attribute ordering on the NumberBox in EditSizeDialog to satisfy the CI XAML Styler check (.\.pipelines\applyXamlStyling.ps1). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Replaces the inline preset-edit Flyout on the Image Resizer settings page with a ContentDialog, matching the add/edit pattern already used on the Color Picker page. This aligns the experience with the Windows 11 / Fluent paradigm and fixes preset settings being saved on every intermediate change.
Editing now happens on a working copy of the preset (
ImageSize.Clone()), which is committed only when the user presses Save/Update. As a side effect, the intermediate width/height spinner changes no longer persistsettings.json/sizes.jsonon every value change — resolving #36938.The per-row delete action moves from an inline trash button into a "..." (More options)
MenuFlyout, again matching the Color Picker page.Historically this editing was a Flyout rather than a ContentDialog due to known
ContentDialog/XamlRootissues back when Settings was a UWP app. Now that Settings is on WinUI 3 / Windows App SDK,ContentDialogworks reliably (as Color Picker'sColorFormatDialogdemonstrates), so the original constraint no longer applies.ImageResizer.mp4
PR Checklist
Resources.resw; reused existing keys for the delete menu)Detailed Description of the Pull Request / Additional comments
EditSizeDialogContentDialog. Fields are bound with compiled{x:Bind}against a working-copyEditingSize. The dimensions field header is dynamic — "Width" when height is used, "Size" for aspect-ratio-preserving percentage scaling — so the label isn't misleading. The dialog is widened for a less cramped layout.ImageSize.Clone()— builds the editable working copy.ImageResizerViewModel.CreateNewImageSizeModel()— builds a default-valued model for the add dialog without adding it toSizes.ImageResizerViewModel.AddImageSize(ImageSize)— commits a new preset with the next unique ID.ImageResizerViewModel.UpdateImageSize(original, updated)— applies edited values back onto the original, temporarily detaching the per-itemPropertyChangedsave handler so it persists once instead of on every property. This is what fixes the "saved too often" behavior in [Settings] ImageResizer settings files may be saved too often #36938.Button→MenuFlyoutwith a DeleteMenuFlyoutItem; theImageSizeis passed viaCommandParameter="{x:Bind}"(robust inside a flyout popup) and the Yes/No confirmation dialog is preserved.Validation Steps Performed
PowerToys.Settings(x64/Debug) — clean (exit 0).