none
Continuous fading in and out of window RRS feed

  • Question

  • I use the following XAML to fade in a window which works fine. However once the window has faded in and reached its target opacity of 1.0 I then want it to fade out again to a target opacity of 0.1 and then once it reaches 0.1 I then need it to fade back in again to 1.0 ad infinitum until the window closes? Any help greatly appreciated.
    <Window.Triggers>
            <EventTrigger RoutedEvent="Window.Loaded">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:4" FillBehavior="HoldEnd" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Window.Triggers>


    Friday, November 22, 2019 11:11 AM

Answers

All replies

  • Hi,
    try this:

      <Window.Triggers>
        <EventTrigger RoutedEvent="Window.Loaded">
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:4" 
                               RepeatBehavior="Forever" AutoReverse="True"/>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Window.Triggers>


    --
    Best Regards / Viele Grüße
    Peter Fleischer (former MVP for Developer Technologies)
    Homepage, Tipps, Tricks

    Friday, November 22, 2019 1:16 PM
  • wow, thank you, much appreciated.
    • Marked as answer by monkey8888z Friday, November 22, 2019 5:09 PM
    Friday, November 22, 2019 5:09 PM