|WPF provides freezable types. These are types that derive from System.Windows.Freezable. Freezable types provide detailed change information and can be made immutable (frozen). This is particularly useful if you define resources that are expensive to modify or copy, and that you know will never change during their lifetime. By freezing these resources, you tell the runtime not to observe any possible modifications to these objects. This improves application performance. Typical examples of freezable objects include brushes, pens, transformations, geometries, and animations.
In order to freeze a resource in XAML, you should include the following namespace. Not all XAML readers recognize the Freeze attribute that is defined in this namespace, so it is recommended to mark the namespace as ignorable.
After doing so, you can freeze the object as follows:
<SolidColorBrush x:Key="TextBrush" po:Freeze="True" Color="Black"/>