I chose smoura's answer as correct because it answers the question I asked. However, I think I might have asked the wrong question, and there is a better solution to the problem.
I decided that I didnβt manage to use the resource, and then I tried to connect this resource. A much better approach is to simply bind the Color property directly. To do this, I created a simple IValueConverter called BrushToColorConverter , and then used this to associate the named brush color with the Foreground property of the Foreground created. The markup is as follows:
<SolidColorBrush x:Name="TextColor" Color="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Converter={StaticResource BrushToColorConverter}}" />
This approach completely excludes the Color resource that I used earlier. This is simpler and, I suspect, more efficient.
source share