如何在主窗口内显示wpf启动画面?
问题描述:
WPF启动画面显示为一个图像不是一个窗口...我的意思是...它看起来像第一个图像来..然后...我的窗口(我的意思是窗口与顶部的酒吧)进来...我如何显示我的主窗口内图像如何在主窗口内显示wpf启动画面?
答
只是试试这个
<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
一个闪屏用于显示的东西,而在创建主窗口和初始化。为什么在显示主窗口后会显示启动画面? 为什么不把主窗口的屏幕截图作为启动画面? – adrianm 2010-07-26 12:33:06