title: How to move between two views after three seconds in WPF C#?
body: <p>I am currently working on a project and I have an image which I want to show for 3 seconds, and then hide it for the rest of the run and show the main grid.</p>
  
  <p>What I tried to do is to put the main grid in a sub grid, with opacity 0 or Visibility = Visibility.Hidden, and implement a stopwatch in the code behind of the public MainWindow() {} Method.
  When I tried an if Statement: if (stopwatch.ElapsedMilliseconds > 3000) {Change Opacity}, I haven't reached the condition and stacked with the first window. When I tried a while approach, by simply adding an empty while loop, nothing was shown up for three seconds, and then I am seeing the main grid straight away.</p>
  
  <p>How can I get the desired result?</p>
  
  <p>Thanks in advance!</p>
  
  <pre><code>public MainWindow()
          {
              InitializeComponent();
  
              ViewModel = (Application.Current as App).VM;
              DataContext = ViewModel;
              Dashboard.DataContext = ViewModel;
  
              this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
              this.Loaded += new RoutedEventHandler(myMediaElement_MediaEnded);
  
              TimeGrinder();
              Page1.Opacity = 0;
              MainGrid.Opacity = 100;
          }
  
          public void TimeGrinder()
          {
              var stopWatch = new Stopwatch();
              stopWatch.Start();
              while (stopWatch.ElapsedMilliseconds &lt; 3000) { }
              return;
          }
  </code></pre>