Skip to content

Performance issue related to Maui Styles #11586

@arivoir

Description

@arivoir

Description

I found a performance issue in a grid control that is setting the "Style" property of the cells and found the issue is caused because the OnPropertyChanged("Background") method is called even if the background doesn't change.

image

I checked the brush set in the old and the new style is the same
image
When the style set is exactly the same object the OnPropertyChanged("Background") is not called (correct), but if the style is a copy of the preview the method is called (Incorrect), OnPropertyChanged("Background") should only be called if the Background changes.

Steps to Reproduce

Create a sample from above description.

Link to public reproduction project repository

No demo

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, Windows, macOS

Affected platform versions

It affects all the platforms

Did you find any workaround?

I can detect whether the styles are the same (despite they are not the same instance), but if another property is different I need to set the style anyway and this will cause the background changed to be triggered.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-xamlXAML, CSS, Triggers, Behaviorsperf/generalThe issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)platform/androidplatform/iosplatform/macosmacOS / Mac Catalystplatform/windowss/triagedIssue has been reviewedt/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions