I am trying to declare a StaticResource explicitly inside a <Style.Resources>
element, but am getting this error when I try to run the application:
Unable to cast object of type 'System.Windows.Media.Effects.DropShadowEffect' to type 'System.Windows.ResourceDictionary'.
Here is the relevant code:
<DropShadowEffect x:Key="Sombra" Opacity="0.5" ShadowDepth="3" BlurRadius="5"/>
<Style x:Key="BotãoNavegaçãoBase" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource BotãoGeometria}">
<Style.Resources>
<StaticResource x:Key="PathShadow" ResourceKey="Sombra"/>
</Style.Resources>
</Style>
And if, following the error message hint, I wrap the <StaticResource/>
in a ResourceDictionary
, I get a "missing key" error:
<Style.Resources>
<ResourceDictionary>
<StaticResource x:Key="PathShadow" ResourceKey="Sombra"/>
</ResourceDictionary>
</Style.Resources>
Missing key value on 'StaticResourceHolder' object.