dotnet / dotnet/winforms

[Dark Mode] Improve visual contrast of the Group Headers in ListView control in dark

Open
#14,198 3 comments 0 reactions 1 assignee Assigned to @SimonZhao888 View on GitHub
area-DarkMode
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

.NET version
9 / 10

### Did it work in .NET Framework?
No

### Issue description

This is a new feature Dark Mode

Issue description
The Group Headers in ListView control is not clear in the DarkMode[Dark Mode]
Improve visual contrast of the Group Headers

Image

### Steps to reproduce

Create a WinForms .NET Core application with ListView control.
Enable DarkMode by Application.SetColorMode(SystemColorMode.Dark) in Program.cs file.
Add Groups and Items to the ListView control.
Run the application.

Sample code:

```
namespace ListViewDarkModeDemo;

internal static class Program
{
[STAThread]
static void Main ()
{
ApplicationConfiguration.Initialize();
Application.SetColorMode(SystemColorMode.System);

ListView lvwTest = new() { Dock = DockStyle.Fill , View = View.Details };
lvwTest.Columns.Add("Column 1");

ListViewGroup lvg = null;
for ( int i = 0 ; i < 7 ; i++ )
{
if ( i < 3 )
{
lvg = new($"Group for item {i}")
{
CollapsedState = i == 1 ? ListViewGroupCollapsedState.Expanded : ListViewGroupCollapsedState.Collapsed ,
Footer = $"Footer of group {i}" ,
Subtitle = $"Subtitle of group {i}"
};
lvwTest.Groups.Add(lvg);
}

ListViewItem lvi = new($"Item {i}") { Group = lvg! };
lvwTest.Items.Add(lvi);
}
lvwTest.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);

Form mainForm = new() { Text = "Dark Mode Test" , Size = new(800 , 600) , StartPosition = FormStartPosition.CenterScreen };
mainForm.Controls.Add(lvwTest);

Application.Run(mainForm);
}
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.