views:

87

answers:

1

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 inside my main window

A: 

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>

Kishore Kumar
Is this the mainwindow.xaml ?
Anish
Splash grid is inside the mainWindow and after 3 or 4 seconds its visibility will go to 0
Kishore Kumar