none
Styles: Animating a DropshadowBitmapEffect from within a style. What is the property Path? RRS feed

  • Question

  • I'm having trouble nailing down a Storyboard Target Property for a triggered Double Animation within a style that changes the shadowdepth of a DropShadowBitmapEffect within a Border.


    • <Style.Triggers>
    •     <EventTrigger RoutedEvent="Border.MouseDown">
    •     <EventTrigger.Actions>
    •     <BeginStoryboard>
    •     <Storyboard>
    •             <DoubleAnimation Duration="0:0:1" Storyboard.TargetProperty="Border.?????" AutoReverse="True" From="1" To="0" By="1">
    •             </DoubleAnimation>
    •     </Storyboard>
    •     </BeginStoryboard>
    •     </EventTrigger.Actions>
    •     </EventTrigger>
    • </Style.Triggers>

     

    Thursday, August 28, 2008 7:34 PM

Answers

  • The following XAMLPad ready example shows how to specify TargetProperty path:

    <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
        <Border Margin="100" BorderBrush="Green" BorderThickness="1">
            <Border.BitmapEffect>
                <DropShadowBitmapEffect
                    Color="Black"
                    Direction="320"/>
            </Border.BitmapEffect>
            <Border.Triggers>
                <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                                Duration="0:0:1"
                                Storyboard.TargetProperty="(Border.BitmapEffect).(DropShadowBitmapEffect.ShadowDepth)"
                                AutoReverse="True"
                                RepeatBehavior="Forever"
                                From="10"
                                To="0"
                                By="1"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Border.Triggers>
        </Border>
    </Page>

    Hope this helps
    • Marked as answer by Marco Zhou Thursday, September 4, 2008 10:11 AM
    Tuesday, September 2, 2008 8:46 AM