You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TextBlock Foreground change re-measures and re-shapes the text #25408
A Foreground change on a TextBlock or one of its runs should only repaint the text. That includes an in-place brush color change, such as a ColorAnimation on the brush. Today it invalidates measure, and the text is shaped again.
Why is this needed? 🤔
TextBlock.OnForegroundChanged calls InvalidateTextBlock(), which calls InvalidateMeasure(), and MeasureOverride always re-parses the text. Run.OnForegroundChanged invalidates its inlines the same way. In WinUI, a brush change on text only dirties render.
The cost scales with the number of TextBlocks sharing the brush. Flipping the color of a brush shared by 2,000 TextBlocks costs about 20 ms of UI-thread time and 14.8 MB of allocations per change, and renders two frames.
The ListViewItemPresenter chrome in #25389 sets the multi-select check glyph's Foreground on every selection change.
For which platforms 📱💻🖥️
Skia (all heads)
Anything else we need to know? 💬
Found while profiling GridView selection for #25389.
Activity