SftTree/NET 3.0 supports dark mode. By default the tree control uses its light colors. An application opts in by setting the DarkMode property to DarkModeEnum.Auto, so the control follows the Windows app mode setting (Settings, Personalization, Colors): users who have selected Dark see dark colors, users who have selected Light see the traditional colors, and the control switches when the setting changes. DarkModeEnum.On always uses dark colors.
What changes in dark mode: colors left at their system defaults are replaced by dark counterparts in the item area, item text, grid and tree lines, selection and hover outlines, column headers, column footers, row headers, tooltips and the border. Column headers, checkboxes, radio buttons, buttons, dropdown buttons, scrollbars and the splitter bar use the dark Windows themes.
The DarkMode property has three values (see DarkModeEnum):
| Value | Description |
|---|---|
| DarkModeEnum.Auto | Follow the Windows app mode setting. The control switches when the setting changes. |
| DarkModeEnum.On | Always use dark colors, regardless of the Windows setting. Useful when the application has its own light/dark setting and wants the tree control to follow it. |
| DarkModeEnum.Off (default) | Always use light colors, regardless of the Windows setting. |
The DarkModeChanged event occurs each time the control switches between light and dark colors, so the application can update its own colors around the tree control. The DarkModeActive property returns the current state at any time.
Colors set by the application for the control, its columns, items, cells and parts are still used in dark mode - the control does not replace colors the application chose. Pick colors that read well on both a light and a dark background, or change them in the DarkModeChanged event.
The color properties keep their values while dark mode is active, so forms saved in the designer while dark mode is active keep their light colors.
Dark mode and Windows High Contrast are independent settings. If both are active, high contrast takes precedence. See High Contrast.