TaskDialogForceCompatibilityMode Property

Gets or sets whether the TaskDialog is to be forced to operate in compatibility mode even if the current operating system supports native task dialogs.

See the online help for image examples.

Definition

Namespace: KGySoft.WinForms.Components
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
public bool ForceCompatibilityMode { get; set; }

Property Value

Boolean

Remarks

Compatibility mode is automatically used in the following cases:

When this property is set to , the following improvements can be observed:

  • If the custom buttons have Description, and buttons are displayed as standard buttons rather than command links, then the descriptions are displayed as tool tips when the buttons are hovered by the mouse.
  • The Description of radio buttons are displayed as tool tips.
  • Ctrl+C copies more information than the standard version (e.g. includes the texts of the radio buttons, indicates elevated icons, etc.)
  • In high contrast mode it is ensured that the content remains visible if Control and Window colors are the inverse of each other.
  • Better support of Right-to-Left mode.

Examples

The following image illustrates native rendering on Windows 11:

TaskDialog with native rendering on Windows 11 in the KGySoft.WinForms.Example application

  Tip

The image above is from the example application. At the Releases page of the project repository you can download it as executable binaries as well.

The same dialog on Windows XP, using compatible rendering (no matter what the value of this property is):

TaskDialog with compatible rendering on Windows XP in the KGySoft.WinForms.Example application

The compatible rendering is automatically applied also when visual styles are not enabled by the Application.EnableVisualStyles method. Note that attempting to use the System.Windows.Forms.TaskDialog (available when targeting .NET 5.0+) would throw an exception in such case. The following image is still the same TaskDialog as above when visual styles are disabled on Windows 11:

TaskDialog with compatible rendering with no visual styles on Windows 11 in the KGySoft.WinForms.Example application

You might want to set this property to even when the native dialog would always work, because the native rendering has some issues in certain cases. For example, in high contrast mode it accidentally mixes Window and Control colors for some visual elements, which does not become apparent until you use a theme where Window and Control background/foreground colors are the inverse of each other:

Native TaskDialog in high contrast mode with inverted Window/Control colors on Windows 11

Whereas in forced compatible mode every control picks their background/foreground colors correctly:

Compatible TaskDialog in high contrast mode with inverted Window/Control colors on Windows 11

See Also