テンプレートで DynamicResource を使用し、そのテンプレートを使用して各スタイル内のリソースとして StaticResourceExtensions を使用しているため、DynamicResource はそれらのそれぞれで異なる方法で評価されます。
問題は、次のエラーが発生することです。
Unable to cast object of type 'System.Windows.Media.Effects.DropShadowEffect' to type 'System.Windows.ResourceDictionary'
これが私のコードです:
<DropShadowEffect
x:Key="Sombra"
Opacity="0.5"
ShadowDepth="3"
BlurRadius="5"
/>
<ControlTemplate
x:Key="ControleGeometriaTemplate"
TargetType="{x:Type Control}"
>
<Border
x:Name="border"
Background="{TemplateBinding Background}"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
/>
<Path
x:Name="ícone"
Fill="{TemplateBinding Foreground}"
Effect="{DynamicResource PathShadow}"
/>
</Border>
</ControlTemplate>
<Style x:Key="BotãoGeometria" TargetType="{x:Type ButtonBase}">
<Setter Property="Template" Value="{StaticResource ControleGeometriaTemplate}"/>
</Style>
<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>