Skip to content

Add missing feasible file and folder dialog options - #6244

Merged
dreddy-work merged 2 commits into
dotnet:mainfrom
willibrandon:5405_file_folder_dialog_options
Dec 15, 2021
Merged

Add missing feasible file and folder dialog options#6244
dreddy-work merged 2 commits into
dotnet:mainfrom
willibrandon:5405_file_folder_dialog_options

Conversation

@willibrandon

@willibrandon willibrandon commented Nov 28, 2021

Copy link
Copy Markdown
Contributor

Fixes #5405

Proposed changes

Add missing feasible file and folder dialog options and expose them via public properties.

  • AddToRecent
  • CheckWriteAccess
  • ExpandedMode
  • OkRequiresInteraction
  • SelectReadOnly
  • ShowHiddenFiles
  • ShowPinnedPlaces
  • ShowPreview
namespace System.Windows.Forms
{
    public partial class FileDialog
    {
        [DefaultValue(true)]
        public bool AddToRecent { get; set; } = true;

        [DefaultValue(false)]
        public bool ShowHiddenFiles { get; set; }

        [DefaultValue(true)]
        public bool ShowPinnedPlaces { get; set; } = true;

        [DefaultValue(false)]
        public bool OkRequiresInteraction { get; set; }
    }

    public partial class OpenFileDialog
    {
        [DefaultValue(false)]
        public bool ShowPreview { get; set; }

        [DefaultValue(true)]
        public bool SelectReadOnly { get; set; } = true;
    }

    public partial class SaveFileDialog
    {
        [DefaultValue(true)]
        public bool ExpandedMode { get; set; } = true;

        [DefaultValue(true)]
        public bool CheckWriteAccess { get; set; } = true;
    }

    public partial class FolderBrowserDialog
    {
        [DefaultValue(true)]
        public bool AddToRecent { get; set; } = true;

        [DefaultValue(false)]
        public bool ShowHiddenFiles { get; set; }

        [DefaultValue(true)]
        public bool ShowPinnedPlaces { get; set; } = true;

        [DefaultValue(false)]
        public bool OkRequiresInteraction { get; set; }
    }
}

Customer Impact

  • Improved file and folder dialog experience.

Regression?

  • No.

Risk

  • I could use some guidance analyzing the risk for this change.
  • I don't know if I've included everything that is necessary for the VS Designer to support this feature.

Videos

AddToRecent

Gets or sets a value indicating whether the dialog box adds the folder being selected to the recent list.

AddToRecent.mp4
CheckWriteAccess

Gets or sets a value indicating whether the dialog box verifies whether creation of the specified file will be successful. If this flag is not set, the calling application must handle errors, such as denial of access, discovered when the item is created.

TestFileCreate.mp4
ExpandedMode

Gets or sets a value indicating whether the dialog box is always opened in the expanded mode.

ExpandedMode.mp4
OkRequiresInteraction

Gets or sets a value indicating whether the OK button of the dialog box is disabled until the user navigates the view or edits the filename (if applicable). Note: Disabling of the OK button does not prevent the dialog from being submitted by the Enter key.

OkButtonNeedsInteraction.mp4
SelectReadOnly

Gets or sets a value indicating whether the dialog box allows to select read-only files.

ReadOnlyReturn.mp4
ShowHiddenFiles

Gets or sets a value indicating whether the dialog box displays hidden and system files.

ForceShowHidden.mp4
ShowPinnedPlaces

Gets or sets a value indicating whether the items shown by default in the view's navigation pane are hidden.

HidePinnedPlaces.mp4
ShowPreview

Gets or sets a value indicating whether the dialog box shows a preview for selected files.

ForcePreviewPaneOn.mp4

Test methodology

  • Added unit tests.
  • Manually tested the changes using WinformsControlsTest -> Dialogs Test (see videos).
  • Ran unit and integration tests.

Accessibility testing

Accessibility Insights for Windows

I'm seeing FastPass automated check failures for the FolderBrowserDialog, OpenFileDialog, and SaveFileDialog prior to making this change. Based on my tests this change does not increase the number of failures detected.

Test environment(s)

  • Windows 10.0.22000
  • .NET Core SDK 6.0.100
Microsoft Reviewers: Open in CodeFlow
@ghost ghost assigned willibrandon Nov 28, 2021
@ghost ghost added the draft draft PR label Nov 28, 2021

@RussKie RussKie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@willibrandon
willibrandon marked this pull request as ready for review November 29, 2021 06:17
@willibrandon
willibrandon requested a review from a team as a code owner November 29, 2021 06:17
@ghost ghost removed the draft draft PR label Nov 29, 2021
hughbe
hughbe previously approved these changes Nov 29, 2021
RussKie
RussKie previously approved these changes Nov 30, 2021
@RussKie RussKie added the waiting-on-team This work item needs to be discussed with team or is waiting on team action in order to proceed label Dec 9, 2021
Comment thread src/System.Windows.Forms/src/Resources/SR.resx Outdated
Comment thread src/System.Windows.Forms/src/Resources/SR.resx Outdated
@ghost ghost added the waiting-author-feedback The team requires more information from the author label Dec 13, 2021
@dreddy-work dreddy-work removed the waiting-on-team This work item needs to be discussed with team or is waiting on team action in order to proceed label Dec 13, 2021
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Dec 14, 2021
@RussKie RussKie added the waiting-author-feedback The team requires more information from the author label Dec 14, 2021
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Dec 14, 2021
@RussKie RussKie added the waiting-author-feedback The team requires more information from the author label Dec 14, 2021
@willibrandon
willibrandon dismissed stale reviews from RussKie and hughbe via 6ea0e75 December 14, 2021 03:46
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Dec 14, 2021

@dreddy-work dreddy-work left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@dreddy-work dreddy-work added the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Dec 14, 2021
@dreddy-work dreddy-work modified the milestones: .NET 7.0, 7.0 Preview1 Dec 14, 2021
@dreddy-work
dreddy-work merged commit f90faff into dotnet:main Dec 15, 2021
@dreddy-work

Copy link
Copy Markdown
Member

Thank you @willibrandon .

@ghost ghost locked as resolved and limited conversation to collaborators Jan 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ready-to-merge PRs that are ready to merge but worth notifying the internal team.

4 participants