Borderbrush coloranimation fade in and out

Ziad picture Ziad · Aug 29, 2011 · Viewed 11.9k times · Source

i have a border , and i change it's borderbrush in the run time. now i need this border to be glowing all the time, whatever the color was.

i tried this but i have problems. any one can help?

<Border   Name="ActiveBorder"  VerticalAlignment="Stretch" Height="auto"  BorderBrush="Transparent" BorderThickness="2" >
            <Border.Style>
                <Style TargetType="{x:Type Border}">
                    <Style.Triggers>
                        <Trigger Property="Visibility" Value="Visible">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation AutoReverse="True" RepeatBehavior="Forever" Storyboard.TargetProperty="BorderBrush" Duration="00:00:01" To="Transparent"></ColorAnimation>       
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                    </Style.Triggers>
                </Style>
        </Border.Style>

Answer

Felice Pollano picture Felice Pollano · Aug 29, 2011

Try to specify:

Storyboard.TargetProperty="BorderBrush.Color"

and either specify:

BorderBrush="any-non-transparent-color"

or in the animation:

From="any-non-transparent-color"