Why not make the animation colors?

<ellipse>
<ellipse.style>
 <style targettype="Ellipse">
<Style.Triggers>
 <EventTrigger RoutedEvent="Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
 <Storyboard TargetProperty="Fill">
 <ColorAnimation To="Yellow" Duration="0:0:3" RepeatBehavior="Forever" AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</style>
</ellipse.style>
<ellipse.triggers>
 <eventtrigger routedevent="Loaded">
<eventtrigger.actions>
<beginstoryboard>
 <storyboard targetproperty="Fill">
 <coloranimation to="Yellow" duration="0:0:3" repeatbehavior="Forever" autoreverse="True">
</coloranimation></storyboard>
</beginstoryboard>
</eventtrigger.actions>
</eventtrigger>
</ellipse.triggers>
</ellipse>

A few questions: firstly how the trigger directly from ellipse, or the trigger style? I tried, but che is not working... and secondly what if in General, that no particular event is not necessary? Just need to was an endless animation. I set the Loaded event, but XS... and third still do animation?
July 9th 19 at 13:06
2 answers
July 9th 19 at 13:08
Solution
Are you trying to animate the Fill property using ColorAnimation, but this property, in the case of casting the circle a solid color, it contains a SolidColorBrush. In turn SolidColorBrush contains a Color property, which you can animate using ColorAnimation.
Here is Your corrected example:
<ellipse width="50" height="50" fill="#fff">
<ellipse.triggers>
 <eventtrigger routedevent="Ellipse.Loaded">
<beginstoryboard>
<storyboard>
 <coloranimation storyboard.targetproperty="(Ellipse.Fill).(SolidColorBrush.Color)" to="Yellow" duration="0:0:3" repeatbehavior="Forever" autoreverse="True">
</coloranimation></storyboard>
</beginstoryboard>
</eventtrigger>
</ellipse.triggers>
</ellipse>


Example with a blinking circle:
<ellipse width="50" height="50" fill="White">
<ellipse.triggers>
 <eventtrigger routedevent="Ellipse.Loaded">
<beginstoryboard>
<storyboard>
 <coloranimationusingkeyframes storyboard.targetproperty="(Ellipse.Fill).(SolidColorBrush.Color)" repeatbehavior="Forever" fillbehavior="Stop">
 <discretecolorkeyframe value="Red" keytime="0:0:3">
 <discretecolorkeyframe value="White" keytime="0:0:3.1">
</discretecolorkeyframe></discretecolorkeyframe></coloranimationusingkeyframes>
</storyboard>
</beginstoryboard>
</eventtrigger>
</ellipse.triggers>
</ellipse>


Explanation on the second example:
ColorAnimationUsingKeyFrames animation color using keyframes on the timeline.
The property FillBehavior="Stop" returns the object to its original state after the animation.

DiscreteColorKeyFrame — key frame animation of colors without smooth transitions between frames.
The property Value specifies the desired value for the animated property (in this case, this property — Fill).
The property KeyTime specifies the position of the keyframe on the timeline.

The KeyTime property of the second key frame of the animation specifies the extent of red. In this example the duration is set to 100ms, because the second key frame is activated via 100 MS after the first.
Thanks, almost that that is necessary. Tell me and you can do the smooth animations, but something like this: 3 seconds have passed, blinked red and back has been replaced, etc. indefinitely. - Adrian.Bogisich commented on July 9th 19 at 13:11
: have updated the answer with an example of blinking. - kim_Schmeler77 commented on July 9th 19 at 13:14
July 9th 19 at 13:10
Show the full markup.
-------------------------------------------
Under the debugger, the exception (full marking)
-------------------------
The first link in Google
https://www.google.ru/?client=opera#newwindow=1&q=...
stackoverflow.com/questions/2248726/wpf-coloranima...
As in the example indicated, everything is OK.
Link about using Google toster.ru/q/320815
This is the full, much fuller then? - Adrian.Bogisich commented on July 9th 19 at 13:13
Open *.xaml ctrl+a ctrl+c ctrl+v - kim_Schmeler77 commented on July 9th 19 at 13:16
Sharp: and what is it such a problem to create a new project and copy the code of my ellipse? Okay I'll do it myself: pastebin.ru/irjF0SP0 . - Adrian.Bogisich commented on July 9th 19 at 13:19
: good sense of humor you however. I know how to use Google. If I ask asked to respond on the merits or does not answer. Seen yet - mercedes commented on July 9th 19 at 13:22
Just told my wife that answer is, "I know how to use Google". As you know, the laugh was on the apartment after reading your reply.
I kindly hinted - study database, use the Google debugger.

Above it is written that your code throws an exception, just below is a link with the solution. Not posuschestvu? Well, no, no, wait for another answer. - Adrian.Bogisich commented on July 9th 19 at 13:25
: Sad that you have no sense of humor. I have no exception is throws. And your link mixed visual basic which I don't know c# where I just don't want to understand because I used to use the markup. If you want to help don't send anyone to Google and write a normal response. And anyway, I don't know how exactly this forum but on many others for the promises in Google already and the punishment given. The answer by the way reportno. - Adrian.Bogisich commented on July 9th 19 at 13:28
There is an example solution in c# . You are too lazy to read carefully a couple of answers to solve my problem? - mercedes commented on July 9th 19 at 13:31

Find more questions by tags XAMLC#WPF