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 850145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:12:58+00:00 2026-05-15T07:12:58+00:00

I’m having a strange problem with a colour animation. I have a list of

  • 0

I’m having a strange problem with a colour animation.

I have a list of items bound to a listbox. These items have an enum property which can have one of three values – NoRemarks, RemarksFound and RemarksUpdated.

On the datatemplate for this listbox, I have a rectangle which displays a colour related to the item status – Red, Orange or Green. There is a data trigger in the template to animate the box, but whenever the animation fires, it appears to sort of retain the old colours. If I animate from red to green, I get a sort of orangy dark green colour. If I animate from orange to green, I get a similar colour, although I can see that the colour is slightly different than when I animate from red to green.

Here is the XAML – I’ve only included the necessary parts:

The rectangle:

<Rectangle x:Name="HeaderRemarkStatusRectangle" Grid.Column="1" Grid.Row="0" Grid.RowSpan="3" HorizontalAlignment="Left"
        RadiusX="1" RadiusY="1" Width="10" Margin="3" StrokeThickness="1" >
    <Rectangle.Stroke>
      <SolidColorBrush Color="#FFDC5A5A" x:Name="RectangleStroke" />
    </Rectangle.Stroke>
    <Rectangle.Fill>
      <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
        <GradientStop Color="#ff7a7a" Offset="0.5" x:Name="GradientStop1" />
        <GradientStop Color="#ff5653" Offset="0.5" x:Name="GradientStop2" />
      </LinearGradientBrush>
    </Rectangle.Fill>
  </Rectangle>

The triggers:

  <DataTrigger Binding="{Binding Path=ItemStatus}" Value="RemarksUpdated">
    <DataTrigger.EnterActions>
      <BeginStoryboard>
        <BeginStoryboard.Storyboard>
          <Storyboard Duration="0:0:0.5" >
            <ColorAnimation Storyboard.TargetName="GradientStop1" Storyboard.TargetProperty="Color" To="#83ec71" />
            <ColorAnimation Storyboard.TargetName="GradientStop2" Storyboard.TargetProperty="Color" To="#5dda4e" />
            <ColorAnimation Storyboard.TargetName="RectangleStroke" Storyboard.TargetProperty="Color" To="#FF50AA46" />
          </Storyboard>
        </BeginStoryboard.Storyboard>
      </BeginStoryboard>
    </DataTrigger.EnterActions>
  </DataTrigger>
</DataTemplate.Triggers>

I have tried a couple of things to correct the problem…

I have tried setting the Datatrigger.exitactions for each trigger to return the colour to white (a bit of a fudge but I wanted to see if the missing “From” section was the problem). When the animation triggered, I ended up with a semi-transparent box, although it was the right colour.

I have also tried setting the “from” property – again,not really practical as I don’t know what the original colour for the trigger would be but I wanted to see the effect. I got a similar result as above.

Also tried changing the FillBehaviour property, but setting it to “stop” meant that the color would revert to the original colour as soon as the animation had completed (as expected).

I thought that the animation would animate from the current colour (either from the datatemplate or from the current animation if one exists), and would animate to the new colour. I can’t quite suss out why I seem to get a colour inbetween the original and new colour. Is this a known problem with the colour animation or is it a problem with my triggers?

Thanks all

  • 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-05-15T07:12:59+00:00Added an answer on May 15, 2026 at 7:12 am

    You need to set the Duration on the ColorAnimation objects. The default Duration for Animations is 1 second, so your 0.5 second storyboard is only running half of the animation.

    <Storyboard>
        <ColorAnimation Storyboard.TargetName="GradientStop1" Storyboard.TargetProperty="Color" To="#83ec71" Duration="0:0:0.5"/>
        <ColorAnimation Storyboard.TargetName="GradientStop2" Storyboard.TargetProperty="Color" To="#5dda4e" Duration="0:0:0.5"/>
        <ColorAnimation Storyboard.TargetName="RectangleStroke" Storyboard.TargetProperty="Color" To="#FF50AA46" Duration="0:0:0.5"/>
    </Storyboard>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
I'm making a simple page using Google Maps API 3. My first. One marker

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.