thewpfguy
thewpfguy

Reputation: 824

WPF Performance: Brushes as resource

The Brushes declared as resources in XAML are 'unfrozen' by default. For our application we have used a tool which generates styles for all the common controls. But I found that it is also declaring a lot of Brushes (SolidColor, LinerGradient etc.) in resource dictionary which is used by our application.

Do you think marking them as 'frozen' is a good practice? Thanks!

Upvotes: 1

Views: 438

Answers (1)

Xcalibur37
Xcalibur37

Reputation: 2323

Yes,

See the suggestion from Microsoft in the following article: http://msdn.microsoft.com/en-us/library/bb613565.aspx

A sample from their analysis:

  • Frozen SolidColorBrush: 212 Bytes
  • Non-frozen SolidColorBrush: 972 Bytes

Upvotes: 1

Related Questions