ローカルリソースを参照できない

定義したローカルリソースを参照できない場面があったのでメモ

家にソース内からうろおぼえでかく


EasingColorKeyFrame.Value

<!-- ローカルリソースの定義(WindowResources内) -->
 <SolidBorderBrush x:Name="hogeColor" Value="#FF000000" />
 <SolidBorderBrush x:Name="hogeColor2" Value="#AA000000" />

<!-- ローカルリソースを使おうとした場所(Style内) -->
<Setter Property="Template">
    <Setter.Value>
        <ControlTemplate TargetType="{x: Type Button}">
            <Border x Name="buttonborder" Background="Transparent" BorderBrush="Transparent" BorderThickness="1" SnapsToDevicePixels="True">
                <Border.Effect>
                    <DropShadowEffect Opacity="0" />
                </Border.Effect>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x Name="Normal">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="buttonborder">
                                    <EasingDoubleKeyFrame KeyTime="0" Value="0.6" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="MouseOver">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="buttonborder">
                                    <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                </DoubleAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="buttonborder">
                                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource hogeColor}" />

                                </ColorAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x Name="Pressed">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="buttonborder">
                                    <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.ShadowDepth)" Storyboard.TargetName="buttonborder">
                                    <EasingDoubleKeyFrame KeyTime="0" Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Color)" Storyboard.TargetName="buttonborder">
                                    <EasingColorKeyFrame KeyTime="0" Value="White" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Opacity)" Storyboard.TargetName="buttonborder">
                                    <EasingDoubleKeyFrame KeyTime="0" Value="0.6" />
                                </DoubleAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="buttonborder">
                                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource hogeColor2}" />
                                </ColorAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x Name="Disabled" />
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <ContentPresenter x Name="buttoncontentPresenter" Focusable="False" Margin="{TemplateBinding Padding}"
                                  HorizontalAlignment="{ TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{ TemplateBinding VerticalContentAlignment}" />
            </Border>
        </ControlTemplate>
    </Setter.Value>
</Setter>

                     <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="buttonborder">
                                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource hogeColor}" />
                     </ColorAnimationUsingKeyFrames>

                     <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="buttonborder">
                                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource hogeColor2}" />
                                </ColorAnimationUsingKeyFrames>

あとこれもだめだったきがする。

DropShadowEffect.Color

<DropShadowEffect Color="{StaticResource hogeColor}"
                     BlurRadius="{Binding ElementName=slider1, Path=Value}"
                     ShadowDepth="{Binding ElementName=slider2, Path=Value}"
                     Direction="{Binding ElementName=slider3, Path=Value}" />

この辺で躓いてるの、なんかXAMLの根幹をいろいろとわかってないのじゃないだろうか。。。