3

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>
Felice Pollano
  • 31,141
  • 8
  • 67
  • 108
Ziad
  • 187
  • 2
  • 3
  • 13

1 Answers1

12

Try to specify:

Storyboard.TargetProperty="BorderBrush.Color"

and either specify:

BorderBrush="any-non-transparent-color"

or in the animation:

From="any-non-transparent-color"
Felice Pollano
  • 31,141
  • 8
  • 67
  • 108
  • That worked, Great. thank you. But why can't i use the "Transparent". It will be more powerfull !!! – Ziad Aug 30 '11 at 06:58
  • because if you use Transparent, you will have an animation starting from transparent and moving to tyransparent, so nothing happens. – Felice Pollano Aug 30 '11 at 07:08
  • As i'm learning more about animation, i can't bind the color property of the animation. i'm having an exception at run time !! any ideas? – Ziad Aug 30 '11 at 07:36
  • This is the new question. Thanks. http://stackoverflow.com/questions/7240480/binding-color-value-for-coloranimation – Ziad Aug 30 '11 at 08:24
  • Setting the StoryBoard.TargetPropertly="BorderBrush.Color" complains that BorderBrush has no Color property. Do you know is that solves the problem? – user3260977 Jun 10 '16 at 16:26