Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Fade Out on a control
    primarykey
    data
    text
    <p>In my WPF app, I have a feedback control that I want to appear after a user action completes (save data, delete...). The visibility is set to Hidden to begin and style set to the animateFadeOut style defined as a resource (see below). Then I want to set the text and control Visibility to visible in my C# code and have the feedback control display the message and fade out after 5 seconds and remain hidden (Visibility.Hidden).</p> <p>The following XAML works the first time I call control.Visiblity= Visibility.Visible but the control doesn't reappear the second time. I figure that is because the animation is still running, which has control over the feedback control. I then tried to set FillBehavior to "Stop" but that just made the control visible again and I want it hidden. Then, with FillBehavior="Stop", I tried to set a trigger "when Opacity = 0, set the Visibility to Hidden". The trigger didn't seem to fire and I was left with the visible control once more after the animation completed.</p> <p>Please help point out what I am doing wrong here.</p> <p>Alternatively, if you can suggest a better way to display a control that fades after 5 seconds and can be called over and over, I would appreciate it.</p> <p>Thanks!</p> <blockquote> <pre><code>&lt;Style TargetType="{x:Type FrameworkElement}" x:Key="animateFadeOut"&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="Visibility" Value="Visible"&gt; &lt;Trigger.EnterActions&gt; &lt;BeginStoryboard &gt; &lt;Storyboard&gt; &lt;DoubleAnimation BeginTime="0:0:5.0" Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="0:0:0.5"/&gt; &lt;/Storyboard&gt; &lt;/BeginStoryboard&gt; &lt;/Trigger.EnterActions&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; </code></pre> </blockquote>
    singulars
    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.
 

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