Search code examples
c#winformsfolderbrowserdialogc#-9.0

How to prevent the FolderBrowserDialog description from wrapping?


We are using a WinForms FolderBrowserDialog in a WPF/C# Application using some and we have a sentence we have added to the Description property on the FolderBrowserDialog (I'm going to change the text for the sake of the screenshot but our message is ABOUT the same length, ignore the text though it's completely different from ours).

I was wondering if there is a way to prevent this from wrapping, I'll show how the Description is set and what the dialog looks like. After upgrading to .NET 5 it also changed the look of the dialog completely.

Description = "Select the folder that contains the particular types of documents you would like to import.",

Why does the Description wrap and can I prevent it?


Solution

  • Use AutoUpgradeEnabled = false; in .NET 5 to get the WinForms FolderBrowserDialog to use the old style of dialog.

    The wrapping was caused by the change in style of dialog when upgrading from .NET 4.8 to .NET 5.0.