2010-07-26 5 views
0

WPF L'écran de démarrage s'affiche comme une image et non comme une fenêtre ... je veux dire ... on dirait qu'une image vient d'abord ... alors ... ma fenêtre (je veux dire une fenêtre avec une barre en haut) entre ... Comment puis-je afficher l'image dans ma fenêtre principaleComment afficher l'écran Splash wpf dans la fenêtre principale?

+0

Un écran de démarrage est utilisé pour afficher quelque chose alors que la fenêtre principale est créé et initialisé. Pourquoi afficher un écran d'accueil après l'affichage de la fenêtre principale? Pourquoi ne pas simplement prendre une capture d'écran de votre fenêtre principale et l'utiliser comme écran de démarrage? – adrianm

Répondre

0

juste essayer ce

<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

Est-ce le mainwindow.xaml? – Relativity

+0

La grille de projection est à l'intérieur de la fenêtre principale et après 3 ou 4 secondes sa visibilité passera à 0 –

Questions connexes