2010-07-26 90 views
0

WPF啓動畫面顯示爲一個圖像不是一個窗口...我的意思是...它看起來像第一個圖像來..然後...我的窗口(我的意思是窗口與頂部的酒吧)進來...我如何顯示我的主窗口內圖像如何在主窗口內顯示wpf啓動畫面?

+0

一個閃屏用於顯示的東西,而在創建主窗口和初始化。爲什麼在顯示主窗口後會顯示啓動畫面? 爲什麼不把主窗口的屏幕截圖作爲啓動畫面? – adrianm 2010-07-26 12:33:06

回答

0

只是試試這個

<Window x:Class="WpfApplication43.Window1" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
Title="Window1" Height="600" Width="800" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" WindowStartupLocation="CenterScreen"> 
<Window.Resources> 
    <Storyboard x:Key="OnLoaded1"> 
     <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="splashGrid" Storyboard.TargetProperty="(UIElement.Opacity)"> 
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> 
      <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/> 
      <SplineDoubleKeyFrame KeyTime="00:00:03" Value="1"/> 
      <SplineDoubleKeyFrame KeyTime="00:00:04" Value="0"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)"> 
      <SplineDoubleKeyFrame KeyTime="00:00:03.6000000" Value="0"/> 
      <SplineDoubleKeyFrame KeyTime="00:00:04.3000000" Value="1"/> 
     </DoubleAnimationUsingKeyFrames> 
    </Storyboard> 
</Window.Resources> 
<Window.Triggers> 
    <EventTrigger RoutedEvent="FrameworkElement.Loaded"> 
     <BeginStoryboard Storyboard="{StaticResource OnLoaded1}"/> 
    </EventTrigger> 
</Window.Triggers> 
    <Grid> 
     <Grid x:Name="LayoutRoot" Opacity="0" Background="#FF180A0A"/> 
     <Grid RenderTransformOrigin="0.5,0.5" Width="400" Height="300" 
      x:Name="splashGrid" 
      Opacity="0" 
       HorizontalAlignment="Center" 
       VerticalAlignment="Center" 
      Margin="0,0,0,0" > 
      <Border BorderBrush="Black" BorderThickness="0" CornerRadius="10" Background="#FFAD6868"> 
       <Grid Margin="5"> 
        <Image Margin="0" Source="The_Midnight_Sun_by_Isilmetriel.jpg" Stretch="Fill"/> 
       </Grid> 
      </Border> 
     </Grid> 
    </Grid> 

+0

這是mainwindow.xaml嗎? – Relativity 2010-07-26 12:48:54

+0

初始網格位於mainWindow內部,3或4秒後其可見性將變爲0 – 2010-07-26 13:08:35