MahApps / MahApps/MahApps.Metro

CheckBox performance is very bad

Open
#4,326 18 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
C#
Stars
9.8k
Forks
2.4k
Avg merge
1h 2m
Merged PRs (30d)
56

Description

Describe the bug

Compared to the built-in WPF checkbox style, the rendering performance is really bad. Perhaps due to the massive amount of attached properties?

I saw some PRs that added fallback values, and have tried that but it didn't help with rendering speed. Only thing that works is removing the checkboxes or going back to WPF's own style.

Steps to reproduce

A description of how to trigger this bug.

  1. Add a listbox with am item template with a checkbox and some other stuff, such as some of the MahApps icons 🙂
  2. Add several hundred items.
  3. Virtualization can be enabled or disabled, it doesn't matter.
  4. Scroll, and see how laggy it is.

Expected behavior

It should not lag.

Actual behavior

It lags.

Environment

MahApps.Metro version: v2.4.9
Windows build number: Win10 22H1
Visual Studio: 2022
Target Framework: .NET v4.7.2, also .NET 6.0.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the lag with a WPF ListBox item template containing a CheckBox and other MahApps icons, using several hundred items with virtualization both enabled and disabled. Compare scrolling against the built-in WPF checkbox style and inspect the CheckBox styling and attached-property usage. Done means scrolling is no longer noticeably laggy in the reported .NET Framework and .NET 6 environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.