Reference to another Brush from one Brush in xaml

brush, resourcedictionary, styles, wpf

Solution

No way I know of to copy the brush itself, but as you say you can copy properties of the brush:

<SolidColorBrush x:Key="FolderColor" Color="{Binding Color, Source={StaticResource PanelBackgroundBrush}}"/>

The above should have the same effect.

Problem

Is it possible to directly reference to a Brush value from another Brush in my resource dictionary, without using a Color definition (or to be exact, copy one brush resource into another)? For example, I have a Brush definition: ``` <SolidColorBrush x:Key="PanelBackgroundBrush" Color="White"/> ``` And I have a couple of other brushes I'd like to be exact the same as "PanelBackgroundBrush", something like so: ``` <SolidColorBrush x:Key="FolderColor" [BrushToCopy]="{StaticResource PanelBackgroundBrush}"/> ``` So that both "PanelBackgroundBrush" and "FolderColor" are using color white. I understand this can be somehow achieved by using a common Color definition.

Original source