Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

using a resourcedictionary in another resourcedictionary

$
0
0

hello everyone

I am using resource dictionaries and now I need to call a resource in another.

to be clear I am making a resource which keeps colors and using another to style a control. in second resource I need to call a color using it's key. is it possible? and if so, how?
here is my codes:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><ResourceDictionary.MergedDictionaries><ResourceDictionary Source="Color.xaml"/><ResourceDictionary><Style TargetType="{x:Type Button}"><Setter Property="Width" Value="100"/><Setter Property="Background" Value="Transparent"/></Style></ResourceDictionary></ResourceDictionary.MergedDictionaries></ResourceDictionary>

instead of the value "Transparent" i need to call a color in this resource:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><SolidColorBrush x:Name="A x:Key="Ablue
/><Color x:Key="Main">#FF179EDC</Color></ResourceDictionary>



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>