Skip to content

OpenFileDialog.ShowReadOnly does not work #6346

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

Open
miloush opened this issue Apr 3, 2022 · 2 comments · May be fixed by #7256
Open

OpenFileDialog.ShowReadOnly does not work #6346

miloush opened this issue Apr 3, 2022 · 2 comments · May be fixed by #7256
Assignees
Labels
🚧 work in progress Investigate Requires further investigation by the WPF team.

Comments

@miloush
Copy link
Contributor

miloush commented Apr 3, 2022

  • .NET Core Version: 7.0.0-preview.2.22152.2
  • Windows version: 22581.1.amd64fre.ni_release.220318-1623
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes

Problem description:

The OpenFileDialog ignores the ShowReadOnly property on the Vista code path.

Actual behavior:

No check box in the dialog.

Expected behavior:

A check box in the dialog as per documentation.

A dropdown option on the Open button would also be acceptable:

Minimal repro:

OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowReadOnly = true;
ofd.ShowDialog();
@lindexi
Copy link
Member

lindexi commented Apr 4, 2022

Sorry, what is the Vista code path ?

@miloush
Copy link
Contributor Author

miloush commented Apr 4, 2022

There are two code paths for the file dialogs, one uses GetOpenFileName API while the other one uses IFileDialog API (introduced in Windows Vista):

if (UseVistaDialog)
{
return RunVistaDialog(hwndOwner);
}
return RunLegacyDialog(hwndOwner);

The legacy one is used on Windows XP only. The Vista one is used everywhere else:

private bool UseVistaDialog
{
get { return Environment.OSVersion.Version.Major >= 6; }
}

.NET Core never supported Windows XP, unlike .NET Framework. However, you can still get the legacy behavior with .NET Core using compatibility settings:

image

@gurpreet-wpf gurpreet-wpf added Bug Product bug (most likely) Investigate Requires further investigation by the WPF team. and removed Untriaged Requires WPF team triage Bug Product bug (most likely) labels Apr 4, 2022
This was referenced Nov 1, 2022
@ghost ghost added the 🚧 work in progress label Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚧 work in progress Investigate Requires further investigation by the WPF team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants