Reputation: 475
I'm working with a .NET 3.5 application that is using System.Windows.Forms.OpenFileDialog. However, no matter what I do, the open dialog only shows the XP-Style version. I've made the code as simple as possible:
OpenFileDialog openFileDialog = new OpenFileDialog()
//openFileDialog.AutoUpgradeEnabled = true; //Adding this line does nothing
if(DialogResult.OK == openFileDialog.ShowDialog())
{ ... }
No matter what I do, the dialog always shows the old XP-Style version instead of the new Vista+ version. I also noticed that when I debug and look at some parameters, there's a protected member variable somewhere in the chain: SettingsSupportVistaDialog
, which in this instance is set to false
. I'm not sure if that is the issue, or where/why this could be getting set.
Does anyone have any suggestions?
Here's a screenshot of the existing (XP-style) dialog
Here's what I want it to look like:
Upvotes: 4
Views: 1719
Reputation: 475
I found the problem. I had to dig into the .NET 3.5 source code, but it turns out that if Application.VisualStyleState
isn't set to ClientAreaEnabled
or ClientAndNonClientAreasEnabled
the old XP-style dialog will be used.
Upvotes: 4