开发者

How to display wpf Splash screen inside main window?

WPF Splash screen getting displayed just as an image not as a window...i mean ...it looks like first an image comes..then...my window(i mean window with a bar at top) comes in...How do I display image ins开发者_JAVA技巧ide my main window


just try this

<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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜