Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8393157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:42:36+00:00 2026-06-09T19:42:36+00:00

I am trying to animate a linear brush on a border using a data

  • 0

I am trying to animate a linear brush on a border using a data trigger but have come accross a problem where I cannot use the TargetName

My code is as follows, can anyone suggest a way to resolve this?

<Border Grid.Row="2" BorderThickness="10" Height="100" Width="100" >
    <Border.BorderBrush>
        <LinearGradientBrush>
            <GradientStop Color="Yellow" Offset="0.0" />
            <GradientStop x:Name="gradient" Color="Orange"  Offset="0.5" />
            <GradientStop Color="Yellow" Offset="1.0" />
        </LinearGradientBrush>
    </Border.BorderBrush>
    <Border.Resources>
        <Style TargetType="Border">
            <Style.Triggers>
                <DataTrigger Binding="{Binding ElementName=testBrdrWin, Path=Pulse}" Value="true">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    Storyboard.TargetName="gradient"
                                    Storyboard.TargetProperty="Offset"
                                    From="0" To="1" Duration="0:0:1"
                                    AutoReverse="True" RepeatBehavior="Forever"
                                    />
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                </DataTrigger>
                <DataTrigger Binding="{Binding ElementName=testBrdrWin, Path=Pulse}" Value="true">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    Storyboard.TargetName="gradient"
                                    Storyboard.TargetProperty="Offset"
                                    To="0.5" Duration="0:0:01"
                                    AutoReverse="False"
                                    />
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Border.Resources>
</Border>

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:42:38+00:00Added an answer on June 9, 2026 at 7:42 pm
    1. You can’t use Storyboard.TargetName here. You have to use a complete PropertyPath Syntax.
    2. LinearGradientBrush has to be in Style itself.

    In this example code I have removed all special things and therefore it will work stand alone too if you MouseOver the Border. Adapt it for your needs again.

    <Border BorderThickness="10" Height="100" Width="100" >
        <Border.Resources>
            <Style TargetType="Border">
                <Setter Property="BorderBrush">
                    <Setter.Value>
                        <LinearGradientBrush>
                            <GradientStop Color="Yellow" Offset="0.0" />
                            <GradientStop Color="Red" Offset="0.5" />
                            <GradientStop Color="Yellow" Offset="1.0" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true">
                        <DataTrigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation
                                    Storyboard.TargetProperty="BorderBrush.(GradientBrush.GradientStops)[1].(GradientStop.Offset)"
                                    From="0" To="1" Duration="0:0:1"
                                    AutoReverse="True" RepeatBehavior="Forever"
                                    />
                                </Storyboard>
                            </BeginStoryboard>
                        </DataTrigger.EnterActions>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </Border.Resources>
    </Border>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to animate object. I use keyframe animation: I have two vertex buffers
I'm trying to animate drop up using negative top, the animation went okay, but
I'm trying to animate background-color,color and border color to change with jquery but for
I'm trying to animate a triangle flipping in canvas using javascript. The problem is
I am trying to animate the width of a rounded rectangle, the problem is
All, I am trying create a 'to & fro' animation using jquery animate &
I have been trying to animate a background position move from a div. The
I'm trying to animate an image (used as background image but it doesn't really
I'm trying to animate a UIWebview being removed from the screen. I'm using an
I'm trying to animate a block level element using jQuery. The page loads with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.