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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:25:36+00:00 2026-05-29T11:25:36+00:00

I want a WPF window to fade in when in opens. I set the

  • 0

I want a WPF window to fade in when in opens. I set the following trigger for the window load:

<Window.Triggers>
    <EventTrigger RoutedEvent="Window.Loaded">
        <BeginStoryboard>
            <Storyboard Name="FormFade">
                <DoubleAnimation  Name="FormFadeAnimation"
                                        Storyboard.TargetName="Window"
                                        Storyboard.TargetProperty="(Window.Opacity)"
                                        From="0.0" To="1.0" Duration="0:0:5"
                                        AutoReverse="False" RepeatBehavior="1x"
                                     />
            </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</Window.Triggers>

The issue is that when the window first loads, it shows all white for the content then disappears and then the window contents fades in as expected. How can I get rid of the flash of white that happens at the beginning? I have even set the background of the window to black but it still flashes white.

  • 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-29T11:25:37+00:00Added an answer on May 29, 2026 at 11:25 am

    I believe the problem is caused by processing in your Window.Loaded handler. The Animation will not run until your Window.Loaded handler finishes executing. I was able to recreate your problem by doing this:

    namespace WpfApplication1
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
            }
    
            void MainWindow_Loaded(object sender, RoutedEventArgs e)
            {
                Thread.Sleep(1000);
            }
        }
    }
    

    The Screen will be White for 1000ms because the animation will not run until the Sleep ends. If you take away the Thread.Sleep() call, the result is what you would expect. My guess is you are doing quite a bit of work in your Loaded handler and the animation is being delayed.

    By the way here is the MainWindow.xaml, pretty much the same to what you have:

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525" x:Name="Window">
        <Window.Triggers>
            <EventTrigger RoutedEvent="Window.Loaded">
                <BeginStoryboard>
                    <Storyboard Name="FormFade">
                        <DoubleAnimation  Name="FormFadeAnimation"
                                            Storyboard.TargetName="Window"
                                            Storyboard.TargetProperty="(Window.Opacity)"
                                            From="0.0" To="1.0" Duration="0:0:5"
                                            AutoReverse="False" RepeatBehavior="1x"
                                         />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Window.Triggers>
        <Grid>
            <TextBlock>asdf</TextBlock>
        </Grid>
    </Window>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got WPF window(WPF browser app) with 3 rectangles. I want to set trigger
I want to set my WPF window's initial client size. I'm not seeing a
So I create a WPF Window manually, and then want to load an existing
I am using Avalon in my WPF app. I want a window similar to
I want the Escape key to close my WPF window. However if there is
I want to open a WPF Window from a Console application. After referring to
I am creating a WPF window with a DataGrid , and I want to
I have a WPF window. I want to add blurring effect. I.e. When i
I want to make a WPF Window that behaves like a context menu. So,
I want to make a reusable WPF Window suitable for different types T. I

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.