Note that there are some explanatory texts on larger screens.

plurals
  1. POIn WPF, after DoubleAnimation UIElement property cannot be changed?
    primarykey
    data
    text
    <p>OK, I'm making a GUI for my MP3 player using WPF and I have a border that enlarges its width property for every second of the played track, thus making a "Progress Bar" for the currently played song. I named the border ProgressBarBorder. After the whole playlist is complete, I wanted to use a DoubleAnimation to fade out the border. Now, if I start the player again, the border reacts as it's supposed to (meaning the width starts from 0 and progresses to the end of the song), but the opacity property for some strange reason stays 0.0 (that is the value that DoubleAnimation sets). I have explicitly coded</p> <pre><code>ProgressBarBorder.Opacity = 1.0; </code></pre> <p>in the method that starts the playback. Nevertheless, it stays invisible. Now, if I don't use DoubleAnimation and just write</p> <pre><code>ProgressBarBorder.Opacity = 0.0; </code></pre> <p>when the playlist is complete, it does go back to 1.0 when I start the player again. This is the reason why I am positive that the animation is the one causing the problem. Also, isn't the property supposed to go back to it's original state after the animation is finished? If yes, my border should become visible automatically after the animation is complete. </p> <p>Here's my partially pseudo-code: </p> <pre><code>if (TrackIsComplete) { DoubleAnimation Fading = new DoubleAnimation(); Fading.From = 1.0; Fading.To = 0.0; Fading.Duration = TimeSpan.FromSeconds(3); ProgressBarBorder.BeginAnimation(Border.OpacityProperty, Fading); } </code></pre> <p>and</p> <pre><code>private void PlayTrack() { ProgressBarBorder.Opacity = 1.0; Play(); .... } </code></pre> <p>Could anyone help please? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload